Revision: 144
http://polepos.svn.sourceforge.net/polepos/?rev=144&view=rev
Author: carlrosenberger
Date: 2010-11-24 15:31:32 +0000 (Wed, 24 Nov 2010)
Log Message:
-----------
cr + pr: NestedLists and InheritanceHierarchy are now working correctly.
Modified Paths:
--------------
trunk/polepos/settings/Circuits.properties
trunk/polepos/settings/DebugCircuits.properties
trunk/polepos/src/org/polepos/RunSeason.java
trunk/polepos/src/org/polepos/data/ListHolder.java
trunk/polepos/src/org/polepos/reporters/Graph.java
trunk/polepos/src/org/polepos/teams/db4o/Db4oTeam.java
trunk/polepos/src/org/polepos/teams/db4o/NestedListsDb4o.java
trunk/polepos/src/org/polepos/teams/hibernate/FlatObjectHibernate.java
trunk/polepos/src/org/polepos/teams/hibernate/HibernateTeam.java
trunk/polepos/src/org/polepos/teams/hibernate/NestedListsHibernate.java
trunk/polepos/src/org/polepos/teams/hibernate/data/ListHolder.java
trunk/polepos/src/org/polepos/teams/jdbc/JdbcDriver.java
trunk/polepos/src/org/polepos/teams/jdbc/JdbcTeam.java
trunk/polepos/src/org/polepos/teams/jdbc/NestedListsJdbc.java
trunk/polepos/src/org/polepos/teams/jdo/JdoTeam.java
trunk/polepos/src/org/polepos/teams/jdo/NestedListsJdo.java
trunk/polepos/src/org/polepos/teams/jdo/data/ListHolder.java
trunk/polepos/src/org/polepos/teams/jdo/data/package.jdo
Added Paths:
-----------
trunk/polepos/src/org/polepos/circuits/inheritancehierarchy/
trunk/polepos/src/org/polepos/circuits/inheritancehierarchy/InheritanceHierarchy.java
trunk/polepos/src/org/polepos/data/InheritanceHierarchy0.java
trunk/polepos/src/org/polepos/data/InheritanceHierarchy1.java
trunk/polepos/src/org/polepos/data/InheritanceHierarchy2.java
trunk/polepos/src/org/polepos/data/InheritanceHierarchy3.java
trunk/polepos/src/org/polepos/data/InheritanceHierarchy4.java
trunk/polepos/src/org/polepos/teams/db4o/InheritanceHierarchyDb4o.java
trunk/polepos/src/org/polepos/teams/hibernate/InheritanceHierarchyHibernate.java
trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.hbm.xml
trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.java
trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.hbm.xml
trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.java
trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy1.java
trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy2.java
trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy3.java
trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy4.java
trunk/polepos/src/org/polepos/teams/jdbc/InheritanceHierarchyJdbc.java
trunk/polepos/src/org/polepos/teams/jdo/InheritanceHierarchyJdo.java
trunk/polepos/src/org/polepos/teams/jdo/data/InheritanceHierarchy0.java
trunk/polepos/src/org/polepos/teams/jdo/data/InheritanceHierarchy1.java
trunk/polepos/src/org/polepos/teams/jdo/data/InheritanceHierarchy2.java
trunk/polepos/src/org/polepos/teams/jdo/data/InheritanceHierarchy3.java
trunk/polepos/src/org/polepos/teams/jdo/data/InheritanceHierarchy4.java
Removed Paths:
-------------
trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.hbm.xml
trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.java
Modified: trunk/polepos/settings/Circuits.properties
===================================================================
--- trunk/polepos/settings/Circuits.properties 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/settings/Circuits.properties 2010-11-24 15:31:32 UTC (rev 144)
@@ -23,13 +23,21 @@
#
# [objects]: number of objects to store as leafs
# [reuse]: number of objects to reuse from the total objects
-# [updates]: number of updates and deletes to be run
# [depth]: depth of the tree
-nestedlists.objects=50,50,50
-nestedlists.reuse=0,15,30
-nestedlists.updates=20,20,20
+nestedlists.objects=40,40,40
+nestedlists.reuse=20,10,1
nestedlists.depth=4,4,4
+
+# inheritancehierarchy
+#
+# [objects]: number of objects to select from
+# [selects]: number of queries run against all objects
+
+inheritancehierarchy.objects=3000,10000,30000
+inheritancehierarchy.selects=100,100,100
+
+
# Settings for all circuits in the database benchmark.
# melbourne
Modified: trunk/polepos/settings/DebugCircuits.properties
===================================================================
--- trunk/polepos/settings/DebugCircuits.properties 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/settings/DebugCircuits.properties 2010-11-24 15:31:32 UTC (rev 144)
@@ -24,14 +24,21 @@
# [objects]: number of objects to store as leafs
# [updates]: number of updates and deletes to be run
# [depth]: depth of the tree
+nestedlists.objects=5,5,5
nestedlists.reuse=1,2,3
-nestedlists.objects=5,5,5
-nestedlists.updates=1,1,1
nestedlists.depth=4,4,4
+# inheritancehierarchy
+#
+# [objects]: number of objects to select from
+# [selects]: number of queries run against all objects
+inheritancehierarchy.objects=100,300,1000
+inheritancehierarchy.selects=10,10,10
+
+
# Settings for the database benchmark
# with short test runs for debugging only
# Results are not signifant
Modified: trunk/polepos/src/org/polepos/RunSeason.java
===================================================================
--- trunk/polepos/src/org/polepos/RunSeason.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/RunSeason.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -23,6 +23,7 @@
import org.polepos.circuits.barcelona.*;
import org.polepos.circuits.flatobject.*;
import org.polepos.circuits.imola.*;
+import org.polepos.circuits.inheritancehierarchy.*;
import org.polepos.circuits.melbourne.*;
import org.polepos.circuits.monaco.*;
import org.polepos.circuits.montreal.*;
@@ -61,6 +62,7 @@
// new ReflectiveCircuitBase(FlatObject.class),
// new ReflectiveCircuitBase(NestedLists.class),
+ // new ReflectiveCircuitBase(InheritanceHierarchy.class),
new Melbourne(),
new Sepang(),
@@ -80,10 +82,12 @@
return new Team[] {
new Db4oTeam(),
new JdoTeam(),
+
// new Db4oClientServerTeam(),
+
new JdbcTeam(),
new HibernateTeam(),
- new JpaTeam(),
+// new JpaTeam(),
// new JviTeam(),
// new CobraTeam(),
Added: trunk/polepos/src/org/polepos/circuits/inheritancehierarchy/InheritanceHierarchy.java
===================================================================
--- trunk/polepos/src/org/polepos/circuits/inheritancehierarchy/InheritanceHierarchy.java (rev 0)
+++ trunk/polepos/src/org/polepos/circuits/inheritancehierarchy/InheritanceHierarchy.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,41 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.circuits.inheritancehierarchy;
+
+import org.polepos.framework.*;
+
+
+@CircuitDescription("writes, reads, queries and deletes objects with a 5 level inheritance structure")
+public interface InheritanceHierarchy {
+
+ @Order(1)
+ public void write();
+
+ @Order(2)
+ public void read();
+
+ @Order(3)
+ public void query();
+
+ @Order(4)
+ public void delete();
+
+
+}
Property changes on: trunk/polepos/src/org/polepos/circuits/inheritancehierarchy/InheritanceHierarchy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/data/InheritanceHierarchy0.java
===================================================================
--- trunk/polepos/src/org/polepos/data/InheritanceHierarchy0.java (rev 0)
+++ trunk/polepos/src/org/polepos/data/InheritanceHierarchy0.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,42 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.data;
+
+
+public class InheritanceHierarchy0 {
+
+ private int i0;
+
+ public InheritanceHierarchy0(){
+ }
+
+ public InheritanceHierarchy0(int i0) {
+ this.i0 = i0;
+ }
+
+ public void setI0(int i){
+ i0 = i;
+ }
+
+ public int getI0(){
+ return i0;
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/data/InheritanceHierarchy0.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/data/InheritanceHierarchy1.java
===================================================================
--- trunk/polepos/src/org/polepos/data/InheritanceHierarchy1.java (rev 0)
+++ trunk/polepos/src/org/polepos/data/InheritanceHierarchy1.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,43 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.data;
+
+
+public class InheritanceHierarchy1 extends InheritanceHierarchy0{
+
+ private int i1;
+
+ public InheritanceHierarchy1(){
+ }
+
+ public InheritanceHierarchy1(int i0, int i1) {
+ super(i0);
+ this.i1 = i1;
+ }
+
+ public void setI1(int i){
+ i1 = i;
+ }
+
+ public int getI1(){
+ return i1;
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/data/InheritanceHierarchy1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/data/InheritanceHierarchy2.java
===================================================================
--- trunk/polepos/src/org/polepos/data/InheritanceHierarchy2.java (rev 0)
+++ trunk/polepos/src/org/polepos/data/InheritanceHierarchy2.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,42 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.data;
+
+
+public class InheritanceHierarchy2 extends InheritanceHierarchy1{
+
+ private int i2; // index this one for queries
+
+ public InheritanceHierarchy2(){
+ }
+
+ public InheritanceHierarchy2(int i0, int i1, int i2) {
+ super(i0, i1);
+ this.i2 = i2;
+ }
+
+ public void setI2(int i){
+ i2 = i;
+ }
+
+ public int getI2(){
+ return i2;
+ }
+}
Property changes on: trunk/polepos/src/org/polepos/data/InheritanceHierarchy2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/data/InheritanceHierarchy3.java
===================================================================
--- trunk/polepos/src/org/polepos/data/InheritanceHierarchy3.java (rev 0)
+++ trunk/polepos/src/org/polepos/data/InheritanceHierarchy3.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,44 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.data;
+
+
+public class InheritanceHierarchy3 extends InheritanceHierarchy2{
+
+ private int i3;
+
+ public InheritanceHierarchy3(){
+ }
+
+ public InheritanceHierarchy3(int i0, int i1, int i2, int i3) {
+ super(i0, i1, i2);
+ this.i3 = i3;
+ }
+
+ public void setI3(int i){
+ i3 = i;
+ }
+
+ public int getI3(){
+ return i3;
+ }
+
+
+}
Property changes on: trunk/polepos/src/org/polepos/data/InheritanceHierarchy3.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/data/InheritanceHierarchy4.java
===================================================================
--- trunk/polepos/src/org/polepos/data/InheritanceHierarchy4.java (rev 0)
+++ trunk/polepos/src/org/polepos/data/InheritanceHierarchy4.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,76 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.data;
+
+import org.polepos.framework.*;
+
+
+public class InheritanceHierarchy4 extends InheritanceHierarchy3 implements CheckSummable{
+
+ public InheritanceHierarchy4(){
+ }
+
+ public InheritanceHierarchy4(int i0, int i1, int i2, int i3, int i4){
+ super(i0, i1, i2, i3);
+ this.i4 = i4;
+ }
+
+ private int i4;
+
+ public void setI4(int i){
+ i4 = i;
+ }
+
+ public int getI4(){
+ return i4;
+ }
+
+ public long checkSum() {
+ return i4;
+ }
+
+ public void setAll(int i){
+ setI0(i);
+ setI1(i);
+ setI2(i);
+ setI3(i);
+ setI4(i);
+ }
+
+ public int getIx(int x){
+ if(x == 0){
+ return getI0();
+ }
+ if(x == 1){
+ return getI1();
+ }
+ if(x == 2){
+ return getI2();
+ }
+ if(x == 3){
+ return getI3();
+ }
+ if(x == 4){
+ return getI4();
+ }
+ throw new IllegalArgumentException();
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/data/InheritanceHierarchy4.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/polepos/src/org/polepos/data/ListHolder.java
===================================================================
--- trunk/polepos/src/org/polepos/data/ListHolder.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/data/ListHolder.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -37,8 +37,6 @@
private List<ListHolder> _list;
public static ListHolder generate(int depth, int leafs, int reuse){
- _idGenerator = new IdGenerator();
-
ListHolder root = generate(new ArrayList<ListHolder>(), depth, leafs, reuse);
root._name = ROOT_NAME;
return root;
@@ -99,19 +97,16 @@
}
}
- public int update(int maxDepth, int depth, int updateCount, Procedure<ListHolder> storeProcedure) {
+ public int update(int maxDepth, int depth, Procedure<ListHolder> storeProcedure) {
Set<ListHolder> visited = new HashSet<ListHolder>();
- return updateInternal(visited, maxDepth, depth, updateCount, storeProcedure);
+ return updateInternal(visited, maxDepth, depth,storeProcedure);
}
- public int updateInternal(Set<ListHolder> visited, int maxDepth, int depth, int updateCount, Procedure<ListHolder> storeProcedure) {
+ public int updateInternal(Set<ListHolder> visited, int maxDepth, int depth, Procedure<ListHolder> storeProcedure) {
if(visited.contains(this)){
return 0;
}
visited.add(this);
- if(depth > maxDepth){
- return 0;
- }
int updatedCount = 1;
if(depth > 0){
_name = "updated " + name();
@@ -119,31 +114,28 @@
if(_list != null){
for (int i = 0; i < _list.size(); i++) {
ListHolder child = _list.get(i);
- updatedCount += child.updateInternal(visited, maxDepth, depth + 1, updateCount, storeProcedure);
+ updatedCount += child.updateInternal(visited, maxDepth, depth + 1, storeProcedure);
}
}
storeProcedure.apply(this);
return updatedCount;
}
- public int delete(int maxDepth, int depth, int updateCount, Procedure<ListHolder> deleteProcedure) {
+ public int delete(int maxDepth, int depth, Procedure<ListHolder> deleteProcedure) {
Set<ListHolder> visited = new HashSet<ListHolder>();
- return deleteInternal(visited, maxDepth, depth, updateCount, deleteProcedure);
+ return deleteInternal(visited, maxDepth, depth, deleteProcedure);
}
- public int deleteInternal(Set<ListHolder> visited, int maxDepth, int depth, int updateCount, Procedure<ListHolder> deleteProcedure) {
+ public int deleteInternal(Set<ListHolder> visited, int maxDepth, int depth, Procedure<ListHolder> deleteProcedure) {
if(visited.contains(this)){
return 0;
}
visited.add(this);
- if(depth > maxDepth){
- return 0;
- }
int deletedCount = 1;
if(_list != null){
for (int i = 0; i < _list.size(); i++) {
ListHolder child = _list.get(i);
- deletedCount += child.deleteInternal(visited, maxDepth, depth + 1, updateCount, deleteProcedure);
+ deletedCount += child.deleteInternal(visited, maxDepth, depth + 1, deleteProcedure);
}
}
deleteProcedure.apply(this);
Modified: trunk/polepos/src/org/polepos/reporters/Graph.java
===================================================================
--- trunk/polepos/src/org/polepos/reporters/Graph.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/reporters/Graph.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -79,7 +79,7 @@
Result res = results.get(new TurnCombination(teamCar,setup));
if(res != null){
if(checkSum != res.getCheckSum()){
- System.err.println("Inconsistent checksum for " + res.getTeam().name() + " in " + circuit.name() + ":" + lap.name());
+ System.err.println("Inconsistent checksum for " + teamCar.getTeam().name() + "/" + teamCar.getCar().name() + " in " + circuit.name() + ":" + lap.name());
}
}
}
Modified: trunk/polepos/src/org/polepos/teams/db4o/Db4oTeam.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/db4o/Db4oTeam.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/db4o/Db4oTeam.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -49,10 +49,9 @@
}
private void addDrivers(){
-
addDriver(new FlatObjectDb4o());
addDriver(new NestedListsDb4o());
-
+ addDriver(new InheritanceHierarchyDb4o());
addDriver(new MelbourneDb4o());
addDriver(new SepangDb4o());
addDriver(new BahrainDb4o());
Added: trunk/polepos/src/org/polepos/teams/db4o/InheritanceHierarchyDb4o.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/db4o/InheritanceHierarchyDb4o.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/db4o/InheritanceHierarchyDb4o.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,79 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.db4o;
+
+import org.polepos.circuits.inheritancehierarchy.*;
+import org.polepos.data.*;
+
+import com.db4o.*;
+import com.db4o.config.*;
+import com.db4o.query.*;
+
+
+public class InheritanceHierarchyDb4o extends Db4oDriver implements InheritanceHierarchy {
+
+
+ @Override
+ public void configure(Configuration config) {
+ indexField(config, InheritanceHierarchy2.class, "i2");
+ }
+
+ @Override
+ public void write(){
+ int count = setup().getObjectCount();
+ begin();
+ for (int i = 1; i<= count; i++) {
+ InheritanceHierarchy4 inheritancheHierarchy4 = new InheritanceHierarchy4();
+ inheritancheHierarchy4.setAll(i);
+ store(inheritancheHierarchy4);
+ }
+ commit();
+ }
+
+ @Override
+ public void read(){
+ doQuery(InheritanceHierarchy4.class);
+ }
+
+ @Override
+ public void query(){
+ int count = setup().getSelectCount();
+ for (int i = 1; i <= count; i++) {
+ Query q = db().query();
+ q.constrain(InheritanceHierarchy4.class);
+ q.descend("i2").constrain(i);
+ doQuery(q);
+ }
+ }
+
+ @Override
+ public void delete(){
+ begin();
+ Query q = db().query();
+ q.constrain(InheritanceHierarchy4.class);
+ ObjectSet<InheritanceHierarchy4> deleteSet = q.execute();
+ while(deleteSet.hasNext()){
+ db().delete(deleteSet.next());
+ addToCheckSum(5);
+ }
+ commit();
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/db4o/InheritanceHierarchyDb4o.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/polepos/src/org/polepos/teams/db4o/NestedListsDb4o.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/db4o/NestedListsDb4o.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/db4o/NestedListsDb4o.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -60,7 +60,7 @@
public void update() throws Throwable {
ListHolder root = root();
activate(root, Integer.MAX_VALUE);
- addToCheckSum(root.update(depth(), 0, updateCount(), new Procedure<ListHolder>() {
+ addToCheckSum(root.update(depth(), 0, new Procedure<ListHolder>() {
@Override
public void apply(ListHolder obj) {
store(obj);
@@ -73,7 +73,7 @@
public void delete() throws Throwable {
ListHolder root = root();
activate(root, Integer.MAX_VALUE);
- addToCheckSum(root.delete(depth(), 0, updateCount(), new Procedure<ListHolder>() {
+ addToCheckSum(root.delete(depth(), 0, new Procedure<ListHolder>() {
@Override
public void apply(ListHolder obj) {
delete(obj);
Modified: trunk/polepos/src/org/polepos/teams/hibernate/FlatObjectHibernate.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/FlatObjectHibernate.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/hibernate/FlatObjectHibernate.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -19,23 +19,20 @@
package org.polepos.teams.hibernate;
-
-
import org.hibernate.*;
import org.polepos.circuits.flatobject.*;
-import org.polepos.data.*;
import org.polepos.teams.hibernate.data.*;
public class FlatObjectHibernate extends HibernateDriver implements FlatObject{
- private final String FROM = "from org.polepos.teams.hibernate.data.HibernateIndexedObject";
+ private final String FROM = "from org.polepos.teams.hibernate.data.IndexedObject";
public void write(){
Transaction tx = begin();
initializeTestId(objectCount());
while ( hasMoreTestIds()){
- HibernateIndexedObject indexedObject = new HibernateIndexedObject(nextTestId());
+ IndexedObject indexedObject = new IndexedObject(nextTestId());
store(indexedObject);
if(doCommit()){
tx.commit();
@@ -67,7 +64,7 @@
Transaction tx = begin();
initializeTestIdD(setup().getUpdateCount());
while(hasMoreTestIds()) {
- HibernateIndexedObject indexedObject = (HibernateIndexedObject) db().iterate(selectFromNextTestId()).next();
+ IndexedObject indexedObject = (IndexedObject) db().iterate(selectFromNextTestId()).next();
indexedObject.updateString();
store(indexedObject);
addToCheckSum(indexedObject);
@@ -79,7 +76,7 @@
Transaction tx = begin();
initializeTestId(setup().getUpdateCount());
while(hasMoreTestIds()) {
- HibernateIndexedObject indexedObject = (HibernateIndexedObject) db().iterate(selectFromNextTestId()).next();
+ IndexedObject indexedObject = (IndexedObject) db().iterate(selectFromNextTestId()).next();
addToCheckSum(indexedObject);
delete(indexedObject);
}
Modified: trunk/polepos/src/org/polepos/teams/hibernate/HibernateTeam.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/HibernateTeam.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/hibernate/HibernateTeam.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -62,6 +62,7 @@
return new DriverBase[] {
new FlatObjectHibernate(),
new NestedListsHibernate(),
+ new InheritanceHierarchyHibernate(),
new MelbourneHibernate(),
new SepangHibernate(),
new BahrainHibernate(),
@@ -102,7 +103,9 @@
public static final Class[] persistentClasses() {
return new Class[] {
- HibernateIndexedObject.class,
+ IndexedObject.class,
+ ListHolder.class,
+ InheritanceHierarchy0.class,
HibernatePilot.class,
HibernateTree.class,
HibernateIndexedPilot.class,
@@ -110,7 +113,7 @@
HibernateLightObject.class,
HibernateListHolder.class,
HN1.class,
- ListHolder.class,
+
};
}
Added: trunk/polepos/src/org/polepos/teams/hibernate/InheritanceHierarchyHibernate.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/InheritanceHierarchyHibernate.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/InheritanceHierarchyHibernate.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,80 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.hibernate;
+
+import java.util.*;
+
+import org.hibernate.*;
+import org.polepos.circuits.barcelona.*;
+import org.polepos.circuits.inheritancehierarchy.*;
+import org.polepos.teams.hibernate.data.*;
+
+
+
+
+public class InheritanceHierarchyHibernate extends HibernateDriver implements InheritanceHierarchy {
+
+ private final String FROM = "from org.polepos.teams.hibernate.data.InheritanceHierarchy4";
+
+ public void write(){
+ try{
+ Transaction tx = db().beginTransaction();
+
+ int count = setup().getObjectCount();
+ for (int i = 1; i<= count; i++) {
+ InheritanceHierarchy4 inheritanceHierarchy4 = new InheritanceHierarchy4();
+ inheritanceHierarchy4.setAll(i);
+ db().save(inheritanceHierarchy4);
+ }
+
+ tx.commit();
+ }
+ catch ( HibernateException hex ){
+ hex.printStackTrace();
+ }
+ }
+
+ public void read(){
+ doQuery(FROM);
+ }
+
+ public void query(){
+ int count = setup().getSelectCount();
+ for (int i = 1; i <= count; i++) {
+ doQuery(FROM + " where i2=" + i);
+ }
+ }
+
+ public void delete(){
+ try{
+ Transaction tx = db().beginTransaction();
+ Iterator it = db().iterate(FROM);
+ while(it.hasNext()){
+ db().delete(it.next());
+ addToCheckSum(5);
+ }
+ tx.commit();
+ }
+ catch ( HibernateException hex ){
+ hex.printStackTrace();
+ }
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/InheritanceHierarchyHibernate.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/polepos/src/org/polepos/teams/hibernate/NestedListsHibernate.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/NestedListsHibernate.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/hibernate/NestedListsHibernate.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -54,7 +54,7 @@
public void update() throws Throwable {
Transaction tx = begin();
ListHolder root = root();
- addToCheckSum(root.update(depth(), 0, updateCount(), new Procedure<ListHolder>() {
+ addToCheckSum(root.update(depth(), new Procedure<ListHolder>() {
@Override
public void apply(ListHolder obj) {
store(obj);
@@ -67,7 +67,7 @@
public void delete() throws Throwable {
Transaction tx = begin();
ListHolder root = root();
- addToCheckSum(root.delete(depth(), 0, updateCount(), new Procedure<ListHolder>() {
+ addToCheckSum(root.delete(depth(), new Procedure<ListHolder>() {
@Override
public void apply(ListHolder listHolder) {
delete(listHolder);
Deleted: trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.hbm.xml
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.hbm.xml 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.hbm.xml 2010-11-24 15:31:32 UTC (rev 144)
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.polepos.teams.hibernate.data">
- <class name="HibernateIndexedObject" table="tHibernateIndexedObject">
- <id column="ID" type="int">
- <generator class="native"/>
- </id>
- <property name="Int" column="fint" type="int" index="fint_idx"/>
- <property name="String" column="fstring" type="string" length="100" index="fstring_idx"/>
- </class>
-</hibernate-mapping>
Deleted: trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -1,75 +0,0 @@
-/*
-This file is part of the PolePosition database benchmark
-http://www.polepos.org
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public
-License along with this program; if not, write to the Free
-Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-
-package org.polepos.teams.hibernate.data;
-
-import org.polepos.data.*;
-import org.polepos.framework.*;
-
-public class HibernateIndexedObject implements CheckSummable{
-
- public int _int;
-
- public String _string;
-
- public HibernateIndexedObject(){
-
- }
-
- public HibernateIndexedObject(int int_, String str){
- _int = int_;
- _string = str;
- }
-
- public HibernateIndexedObject(int int_){
- this(int_, IndexedObject.queryString(int_));
- }
-
- @Override
- public long checkSum() {
- return _string.length();
- }
-
- public void updateString() {
- _string = _string.toUpperCase();
- }
-
- @Override
- public String toString() {
- return "JdoIndexedObject _int:" + _int + " _string:" + _string;
- }
-
- public int getInt() {
- return _int;
- }
-
- public void setInt(int i) {
- _int = i;
- }
-
- public String getString() {
- return _string;
- }
-
- public void setString(String string) {
- _string = string;
- }
-
-}
Copied: trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.hbm.xml (from rev 135, trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.hbm.xml)
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.hbm.xml (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.hbm.xml 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.polepos.teams.hibernate.data">
+ <class name="IndexedObject" table="tIndexedObject">
+ <id column="ID" type="int">
+ <generator class="native"/>
+ </id>
+ <property name="Int" column="fint" type="int" index="fint_idx"/>
+ <property name="String" column="fstring" type="string" length="100" index="fstring_idx"/>
+ </class>
+</hibernate-mapping>
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.hbm.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.java (from rev 135, trunk/polepos/src/org/polepos/teams/hibernate/data/HibernateIndexedObject.java)
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,95 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+
+package org.polepos.teams.hibernate.data;
+
+import org.polepos.framework.*;
+
+public class IndexedObject implements CheckSummable{
+
+ private static final int STRING_LENGTH = 20;
+
+ private static final String UNDERSCORES = underscores();
+
+
+ public int _int;
+
+ public String _string;
+
+ public IndexedObject(){
+
+ }
+
+ public IndexedObject(int int_, String str){
+ _int = int_;
+ _string = str;
+ }
+
+ public IndexedObject(int int_){
+ this(int_, queryString(int_));
+ }
+
+ @Override
+ public long checkSum() {
+ return _string.length();
+ }
+
+ public static String queryString(int int_){
+ StringBuffer sb = new StringBuffer();
+ sb.append("str");
+ sb.append(int_);
+ sb.append(UNDERSCORES);
+ return sb.substring(0, STRING_LENGTH);
+ }
+
+ private static String underscores() {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < STRING_LENGTH; i++) {
+ sb.append("_");
+ }
+ return sb.toString();
+ }
+
+ public void updateString() {
+ _string = _string.toUpperCase();
+ }
+
+ @Override
+ public String toString() {
+ return "IndexedObject _int:" + _int + " _string:" + _string;
+ }
+
+ public int getInt() {
+ return _int;
+ }
+
+ public void setInt(int i) {
+ _int = i;
+ }
+
+ public String getString() {
+ return _string;
+ }
+
+ public void setString(String string) {
+ _string = string;
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/IndexedObject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.hbm.xml
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.hbm.xml (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.hbm.xml 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.polepos.teams.hibernate.data">
+ <class name="InheritanceHierarchy0" table="tInheritanceHierarchy0">
+ <id column="ID" type="int">
+ <generator class="native"/>
+ </id>
+ <property name="i0" column="i0" type="int"/>
+ <joined-subclass name="InheritanceHierarchy1" table="tInheritanceHierarchy1">
+ <key column="parent0"/>
+ <property name="i1" column="i1" type="int"/>
+ <joined-subclass name="InheritanceHierarchy2" table="tInheritanceHierarchy2">
+ <key column="parent1"/>
+ <property name="i2" column="i2" type="int" index="i2_idx"/>
+ <joined-subclass name="InheritanceHierarchy3" table="tInheritanceHierarchy3">
+ <key column="parent2"/>
+ <property name="i3" column="i3" type="int"/>
+ <joined-subclass name="InheritanceHierarchy4" table="tInheritanceHierarchy4">
+ <key column="parent3"/>
+ <property name="i4" column="i4" type="int"/>
+ </joined-subclass>
+ </joined-subclass>
+ </joined-subclass>
+ </joined-subclass>
+ </class>
+</hibernate-mapping>
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.hbm.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,42 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.hibernate.data;
+
+
+public class InheritanceHierarchy0 {
+
+ private int i0;
+
+ public InheritanceHierarchy0(){
+ }
+
+ public InheritanceHierarchy0(int i0) {
+ this.i0 = i0;
+ }
+
+ public void setI0(int i){
+ i0 = i;
+ }
+
+ public int getI0(){
+ return i0;
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy0.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy1.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy1.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy1.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,43 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.hibernate.data;
+
+
+public class InheritanceHierarchy1 extends InheritanceHierarchy0{
+
+ private int i1;
+
+ public InheritanceHierarchy1(){
+ }
+
+ public InheritanceHierarchy1(int i0, int i1) {
+ super(i0);
+ this.i1 = i1;
+ }
+
+ public void setI1(int i){
+ i1 = i;
+ }
+
+ public int getI1(){
+ return i1;
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy2.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy2.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy2.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,42 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.hibernate.data;
+
+
+public class InheritanceHierarchy2 extends InheritanceHierarchy1{
+
+ private int i2; // index this one for queries
+
+ public InheritanceHierarchy2(){
+ }
+
+ public InheritanceHierarchy2(int i0, int i1, int i2) {
+ super(i0, i1);
+ this.i2 = i2;
+ }
+
+ public void setI2(int i){
+ i2 = i;
+ }
+
+ public int getI2(){
+ return i2;
+ }
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy3.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy3.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy3.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,44 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.hibernate.data;
+
+
+public class InheritanceHierarchy3 extends InheritanceHierarchy2{
+
+ private int i3;
+
+ public InheritanceHierarchy3(){
+ }
+
+ public InheritanceHierarchy3(int i0, int i1, int i2, int i3) {
+ super(i0, i1, i2);
+ this.i3 = i3;
+ }
+
+ public void setI3(int i){
+ i3 = i;
+ }
+
+ public int getI3(){
+ return i3;
+ }
+
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy3.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy4.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy4.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy4.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,76 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.hibernate.data;
+
+import org.polepos.framework.*;
+
+
+public class InheritanceHierarchy4 extends InheritanceHierarchy3 implements CheckSummable{
+
+ public InheritanceHierarchy4(){
+ }
+
+ public InheritanceHierarchy4(int i0, int i1, int i2, int i3, int i4){
+ super(i0, i1, i2, i3);
+ this.i4 = i4;
+ }
+
+ private int i4;
+
+ public void setI4(int i){
+ i4 = i;
+ }
+
+ public int getI4(){
+ return i4;
+ }
+
+ public long checkSum() {
+ return i4;
+ }
+
+ public void setAll(int i){
+ setI0(i);
+ setI1(i);
+ setI2(i);
+ setI3(i);
+ setI4(i);
+ }
+
+ public int getIx(int x){
+ if(x == 0){
+ return getI0();
+ }
+ if(x == 1){
+ return getI1();
+ }
+ if(x == 2){
+ return getI2();
+ }
+ if(x == 3){
+ return getI3();
+ }
+ if(x == 4){
+ return getI4();
+ }
+ throw new IllegalArgumentException();
+ }
+
+}
Property changes on: trunk/polepos/src/org/polepos/teams/hibernate/data/InheritanceHierarchy4.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/polepos/src/org/polepos/teams/hibernate/data/ListHolder.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/hibernate/data/ListHolder.java 2010-11-22 13:35:04 UTC (rev 143)
+++ trunk/polepos/src/org/polepos/teams/hibernate/data/ListHolder.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -97,20 +97,17 @@
}
}
- public int update(int maxDepth, int depth, int updateCount, Procedure<ListHolder> storeProcedure) {
+ public int update(int maxDepth, Procedure<ListHolder> storeProcedure) {
Set<ListHolder> visited = new HashSet<ListHolder>();
- return updateInternal(visited, maxDepth, depth, updateCount, storeProcedure);
+ return updateInternal(visited, maxDepth, 0, storeProcedure);
}
- public int updateInternal(Set<ListHolder> visited, int maxDepth, int depth, int updateCount, Procedure<ListHolder> storeProcedure) {
+ public int updateInternal(Set<ListHolder> visited, int maxDepth, int depth, Procedure<ListHolder> storeProcedure) {
if(visited.contains(this)){
return 0;
}
visited.add(this);
- if(depth > maxDepth){
- return 0;
- }
int updatedCount = 1;
if(depth > 0){
name = "updated " + name;
@@ -119,31 +116,28 @@
if(list != null){
for (int i = 0; i < list.size(); i++) {
ListHolder child = list.get(i);
- updatedCount += child.updateInternal(visited, maxDepth, depth + 1, updateCount, storeProcedure);
+ updatedCount += child.updateInternal(visited, maxDepth, depth + 1, storeProcedure);
}
}
storeProcedure.apply(this);
return updatedCount;
}
- public int delete(int maxDepth, int depth, int updateCount, Procedure<ListHolder> deleteProcedure) {
+ public int delete(int maxDepth, Procedure<ListHolder> deleteProcedure) {
Set<ListHolder> visited = new HashSet<ListHolder>();
- return deleteInternal(visited, maxDepth, depth, updateCount, deleteProcedure);
+ return deleteInternal(visited, maxDepth, 0, deleteProcedure);
}
- public int deleteInternal(Set<ListHolder> visited, int maxDepth, int depth, int updateCount, Procedure<ListHolder> deleteProcedure) {
+ public int deleteInternal(Set<ListHolder> visited, int maxDepth, int depth, Procedure<ListHolder> deleteProcedure) {
if(visited.contains(this)){
return 0;
}
visited.add(this);
- if(depth > maxDepth){
- return 0;
- }
int deletedCount = 1;
if(list != null){
for (int i = 0; i < list.size(); i++) {
ListHolder child = getList().get(i);
- deletedCount += child.deleteInternal(visited, maxDepth, depth + 1, updateCount, deleteProcedure);
+ deletedCount += child.deleteInternal(visited, maxDepth, depth + 1, deleteProcedure);
}
}
deleteProcedure.apply(this);
Added: trunk/polepos/src/org/polepos/teams/jdbc/InheritanceHierarchyJdbc.java
===================================================================
--- trunk/polepos/src/org/polepos/teams/jdbc/InheritanceHierarchyJdbc.java (rev 0)
+++ trunk/polepos/src/org/polepos/teams/jdbc/InheritanceHierarchyJdbc.java 2010-11-24 15:31:32 UTC (rev 144)
@@ -0,0 +1,181 @@
+/*
+This file is part of the PolePosition database benchmark
+http://www.polepos.org
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+package org.polepos.teams.jdbc;
+
+import java.sql.*;
+
+import org.polepos.circuits.barcelona.*;
+import org.polepos.circuits.inheritancehierarchy.*;
+import org.polepos.data.*;
+import org.polepos.framework.*;
+
+
+
+public class InheritanceHierarchyJdbc extends JdbcDriver implements InheritanceHierarchy {
+
+ private static final String[] TABLES = new String[]{
+ "inheritanceHierarchy0",
+ "inheritanceHierarchy1",
+ "inheritanceHierarchy2",
+ "inheritanceHierarchy3",
+ "inheritanceHierarchy4",
+ };
+
+ public void takeSeatIn(Car car, TurnSetup setup) throws CarMotorFailureException{
+
+ super.takeSeatIn(car, setup);
+ openConnection();
+
+ int i = 0;
+ for(String table : TABLES){
+ dropTable( table);
+ createTable( table, new String[]{ "id", "parent", "i" + i},
+ new Class[]{Integer.TYPE, Integer.TYPE, Integer.TYPE} );
+ createIndex( table, "parent" );
+ if(i == 2){
+ createIndex( table, "i2" );
+ }
+ i++;
+ }
+ close();
+
+ }
+
+
+ @Override
+ public void write() {
+
+ try{
+ PreparedStatement[] statements = new PreparedStatement[5];
+ for (int i = 0; i < 5; i++) {
+ statements[i] = prepareStatement("insert into " + TABLES[i] + " (id, parent, i" + i + ") values (?,?,?)");
+ }
+
+ int count = setup().getObjectCount();
+ for (int j = 0; j < 5; j++) {
+ for (int i = 1; i <= count; i++) {
+
+ InheritanceHierarchy4 inheritanceHierarchy4 = new InheritanceHierarchy4();
+ inheritanceHierarchy4.setAll(i);
+ statements[j].setInt(1, i);
+ statements[j].setInt(2, i);
+ statements[j].setInt(3, inheritanceHierarchy4.getIx(j));
+ statements[j].addBatch();
+ }
+ statements[j].executeBatch();
+ statements[j].close();
+ }
+ } catch (SQLException sqlex) {
+ sqlex.printStackTrace();
+ }
+
+ commit();
+
+ }
+
+ @Override
+ public void read() {
+ StringBuffer sql = select();
+ sql.append(TABLES[0]);
+ sql.append(".id=?");
+ query(sql.toString(), setup().getObjectCount());
+ }
+
+
+ @Override
+ public void query() {
+ StringBuffer sql = select();
+ sql.append(TABLES[2]);
+ sql.append(".i2=?");
+ query(sql.toString(), setup().getSelectCount());
+ }
+
+ /**
+ * deleting one at a time, simulating deleting individual objects
+ */
+ @Override
+ public void delete(){
+
+ int count = setup().getObjectCount();
+
+ PreparedStatement[] statements = new PreparedStatement[5];
+ for (int i = 0; i < 5; i++) {
+ statements[i] = prepareStatement("delete from " + TABLES[i] + " where id=?");
+ }
+
+ try {
+ for (int j = 0; j < 5; j++) {
+ for (int i = 1; i <= count; i++) {
+ statements[j].setInt(1, i);
+ addToCheckSum(1);
+ statements[j].addBatch();
+ }
+ statements[j].executeBatch();
+ statements[j].close();
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ commit();
+ }
+
+ private StringBuffer select(){
+ StringBuffer sql = new StringBuffer("select * from ");
+ sql.append(TABLES[0]);
+ for (int i = 1; i < TABLES.length; i++) {
+ sql.append(", ");
+ sql.append(TABLES[i]);
+ }
+ sql.append(" where ");
+ for (int i = 1; i < TABLES.length; i++) {
+ sql.append(TABLES[i]);
+ sql.append(".parent = ");
+ sql.append(TABLES[i - 1]);
+ sql.append(".id");
+ sql.append(" and ");
+ }
+ return sql;
+ }
+
+ private void query(String sql, int count){
+ PreparedStatement statement = prepareStatement(sql.toString());
+
+ try {
+ for(int i = 1 ; i <= count; i++) {
+ statement.setInt(1,i);
+ ResultSet rs=statement.executeQuery();
+ if(!rs.next()) {
+ System.err.println("Expected one result, received none: "+ i);
+ }
+ B4 b4 = new B4(rs.getInt(3), rs.getInt(6), rs.getInt(9), rs.getInt(12), rs.getInt(15));
+ addToCheckSum(b4.checkSum());
+ if(rs.next()) {
+ System.err.println("Expected one result, r...
[truncated message content] |