db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r422236 [1/3] - in /db/ojb/trunk/src: schema/ test/org/apache/ojb/broker/ test/org/apache/ojb/broker/cache/ test/org/apache/ojb/broker/cloneable/ test/org/apache/ojb/broker/metadata/ test/org/apache/ojb/broker/metadata/torque/
Date Sat, 15 Jul 2006 14:38:16 GMT
Author: arminw
Date: Sat Jul 15 07:38:14 2006
New Revision: 422236

URL: http://svn.apache.org/viewvc?rev=422236&view=rev
Log:
merge trunk with 1.0.x

Modified:
    db/ojb/trunk/src/schema/ojbcore-schema.xml
    db/ojb/trunk/src/schema/ojbtest-data-new.xml
    db/ojb/trunk/src/schema/ojbtest-data.dtd
    db/ojb/trunk/src/schema/ojbtest-data.xml
    db/ojb/trunk/src/schema/ojbtest-schema.xml
    db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/ArticleWithStockDetail.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/BidirectionalAssociationTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest2.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/Container.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/ExtentAwarePathExpressionsTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/FactoryCreatedBaseObject.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/FactoryCreatedObject.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/FieldConversionTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/InitializableObject.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/KeyConstraintViolationTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/M2NTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/MtoNTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/MultipleDBTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/ObjectRepository.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/OneToManyTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/Ownable1Impl.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/Ownable2Impl.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/Owner.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/cache/LocalCacheTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/cloneable/CloneableGroup.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/PersistentFieldPerfTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/PersistentFieldTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/ReadonlyTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/RepositoryPersistorTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/torque/TorqueForeignKeyGeneratorTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/torque/TorqueRepositoryGeneratorTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/torque/TorqueTableGeneratorTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/torque/TorqueTablePreprocessorTest.java

Modified: db/ojb/trunk/src/schema/ojbcore-schema.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/schema/ojbcore-schema.xml?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/schema/ojbcore-schema.xml (original)
+++ db/ojb/trunk/src/schema/ojbcore-schema.xml Sat Jul 15 07:38:14 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
-<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_1.dtd">
+<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
 <!--
 #/* Copyright 2002-2004 The Apache Software Foundation
 # *

Modified: db/ojb/trunk/src/schema/ojbtest-data-new.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/schema/ojbtest-data-new.xml?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/schema/ojbtest-data-new.xml (original)
+++ db/ojb/trunk/src/schema/ojbtest-data-new.xml Sat Jul 15 07:38:14 2006
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
 <!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
 <!--
 #/* Copyright 2002-2006 The Apache Software Foundation
@@ -17,6 +17,7 @@
 # */
 -->
 <dataset name="all">
+
     <ProductGroup groupId="1" groupName="Beverages" description="Alles leckere zum Süffeln"/>
     <ProductGroup groupId="2" groupName="Spices" description="Gewürze, Dressings etc."/>
     <ProductGroup groupId="3" groupName="Meat" description=""/>
@@ -25,6 +26,7 @@
     <ProductGroup groupId="6" groupName="bread" description=""/>
     <ProductGroup groupId="7" groupName="Fruits" description="Früchte etc."/>
     <ProductGroup groupId="8" groupName="Dairy Products" description="Kat 8"/>
+    <ProductGroup groupId="4711" groupName="Random Articles" description="Used for MetadataMultithreadedTest"/>
 
     <Article articleId="1" articleName="Chai" supplierId="1" productGroupId="1" unit="10 boxes x 20 bags" price="18.53" stock="39" orderedUnits="0" minimumStock="10" isSelloutArticle="0"/>
     <Article articleId="2" articleName="Chang" supplierId="1" productGroupId="1" unit="24 - 12 oz bottles" price="19.89" stock="17" orderedUnits="40" minimumStock="25" isSelloutArticle="0"/>
@@ -103,6 +105,9 @@
     <Article articleId="75" articleName="Rhönbräu Klosterbier" supplierId="12" productGroupId="1" unit="24 - 0.5 l bottles" price="7.75" stock="125" orderedUnits="0" minimumStock="25" isSelloutArticle="0"/>
     <Article articleId="76" articleName="Lakkalikööri" supplierId="23" productGroupId="1" unit="500 ml" price="18.0" stock="57" orderedUnits="0" minimumStock="20" isSelloutArticle="0"/>
     <Article articleId="77" articleName="Original Frankfurter grüne Soße" supplierId="12" productGroupId="2" unit="12 boxes" price="13.0" stock="32" orderedUnits="0" minimumStock="15" isSelloutArticle="0"/>
+    <Article articleId="4711" articleName="Proxied Article 1" supplierId="12" productGroupId="4711" unit="1 Java class" price="1.3" stock="5" orderedUnits="0" minimumStock="1" isSelloutArticle="0"/>
+    <Article articleId="4712" articleName="Proxied Article 2" supplierId="12" productGroupId="4711" unit="1 Java class" price="1.5" stock="2" orderedUnits="0" minimumStock="0" isSelloutArticle="0"/>
+    <Article articleId="4713" articleName="Proxied Article 3" supplierId="12" productGroupId="4711" unit="1 Java class" price="1.9" stock="7" orderedUnits="0" minimumStock="5" isSelloutArticle="0"/>
 
     <BookArticle articleId="100" articleName="Hamlet" supplierId="12" productGroupId="5" unit="12 boxes" price="34.0" stock="32" orderedUnits="0" minimumStock="15" isSelloutArticle="0" isbn="1234567890" author="W. Shakespeare"/>
     <BookArticle articleId="101" articleName="Faust" supplierId="12" productGroupId="5" unit="12 boxes" price="56.0" stock="32" orderedUnits="0" minimumStock="15" isSelloutArticle="0" isbn="1234567890" author="J.W. v. Goethe"/>
@@ -135,8 +140,8 @@
 
     <Role member_id="1" project_id="1" roleName="founder"/>
     <Role member_id="1" project_id="2" roleName="friend"/>
-    <Role member_id="2" project_id="2" roleName="lead"/>
     <Role member_id="2" project_id="1" roleName="developer"/>
+    <Role member_id="2" project_id="2" roleName="lead"/>
     <Role member_id="2" project_id="3" roleName="developer"/>
     <Role member_id="3" project_id="2" roleName="tester"/>
     <Role member_id="3" project_id="4" roleName="user"/>

Modified: db/ojb/trunk/src/schema/ojbtest-data.dtd
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/schema/ojbtest-data.dtd?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/schema/ojbtest-data.dtd (original)
+++ db/ojb/trunk/src/schema/ojbtest-data.dtd Sat Jul 15 07:38:14 2006
@@ -180,7 +180,8 @@
     PDTable|
     Owner|
     Ownable1|
-    Ownable2)*>
+    Ownable2
+    )*>
 <!ATTLIST dataset
     name CDATA #REQUIRED
 >
@@ -356,8 +357,8 @@
     DetailText CDATA #IMPLIED
 >
 
-<!ELEMENT PointTable EMPTY>
-<!ATTLIST PointTable
+<!ELEMENT Point EMPTY>
+<!ATTLIST Point
     Id CDATA #REQUIRED
     X CDATA #REQUIRED
     Y CDATA #REQUIRED

Modified: db/ojb/trunk/src/schema/ojbtest-data.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/schema/ojbtest-data.xml?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/schema/ojbtest-data.xml (original)
+++ db/ojb/trunk/src/schema/ojbtest-data.xml Sat Jul 15 07:38:14 2006
@@ -131,12 +131,12 @@
     <Person Id="9" Firstname="guido" Lastname="guido"/>
     <Person Id="10" Firstname="hank%" Lastname="hank"/>
 
-    <Project Id="1" Title="OJB" Description="OJB"/>
-    <Project Id="2" Title="SODA" Description="SODA"/>
-    <Project Id="3" Title="HSQLDB" Description="HSQLDB"/>
-    <Project Id="4" Title="XERCES" Description="XERCES"/>
-    <Project Id="5" Title="Linux" Description="Linux"/>
-    <Project Id="6" Title="mySQL" Description="mySQL"/>
+    <Project Id="1" Title="OJB" Description="OJB" />
+    <Project Id="2" Title="SODA" Description="SODA" />
+    <Project Id="3" Title="HSQLDB" Description="HSQLDB" />
+    <Project Id="4" Title="XERCES" Description="XERCES" />
+    <Project Id="5" Title="Linux" Description="Linux" />
+    <Project Id="6" Title="mySQL" Description="mySQL" />
 
     <PersonProject PersonId="1" ProjectId="1" Rolename="founder"/>
     <PersonProject PersonId="1" ProjectId="2" Rolename="friend"/>
@@ -180,8 +180,8 @@
     <News Id="2" Headline="Ferrai for sale (CARS - BUYERS)"/>
     <News Id="3" Headline="Brazil World Cup Champion ! (SPORTS)"/>
 
-    <Paper Id="10" Headline="NONE" Issuedate="today" Author="NONE"/>
-    <Paper Id="11" Headline="SALES" Issuedate="yesterday" Author="SALES MAN"/>
+    <Paper Id="10" Issuedate="today" Author="NONE"/>
+    <Paper Id="11" Issuedate="yesterday" Author="SALES MAN"/>
 
     <Topic Id="10" Name="Buyers" Importance="important"/>
     <Topic Id="11" Name="Sellers" Importance="unimportant"/>

Modified: db/ojb/trunk/src/schema/ojbtest-schema.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/schema/ojbtest-schema.xml?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/schema/ojbtest-schema.xml (original)
+++ db/ojb/trunk/src/schema/ojbtest-schema.xml Sat Jul 15 07:38:14 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
-<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_1.dtd">
+<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
 <!--
 #/* Copyright 2002-2004 The Apache Software Foundation
 # *
@@ -208,13 +208,13 @@
     <column name="FATHER_ID" type="INTEGER"/>
   </table>
 
-  <table name="LOCKED_BY_VERSION">
+  <table name="VERSIONLOCKED">
     <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="VALUE_" type="VARCHAR" size="150"/>
     <column name="VERSION_" type="INTEGER"/>
   </table>
 
-  <table name="LOCKED_BY_TIMESTAMP">
+  <table name="TIMESTAMPLOCKED">
     <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="VALUE_" type="VARCHAR" size="150"/>
     <column name="TIMESTAMP_" type="TIMESTAMP"/>
@@ -239,7 +239,7 @@
     <column name="MASTER_TEXT" type="VARCHAR" size="255"/>
   </table>
 
-  <table name="MDTEST_DETAIL_FKINPK">
+  <table name="MDTEST_FKINPK">
     <column name="MASTERID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="DETAILID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="DETAIL_TEXT" type="VARCHAR" size="255"/>
@@ -248,7 +248,7 @@
     </foreign-key>
   </table>
 
-  <table name="MDTEST_DETAIL_FKNOPK">
+  <table name="MDTEST_FKNOPK">
     <column name="DETAILID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="MASTERID" required="true" type="INTEGER"/>
     <column name="DETAIL_TEXT" type="VARCHAR" size="255"/>
@@ -378,8 +378,8 @@
     </table>
 
     <table name="BIDIR_A">
-       <column name="pk" required="true" primaryKey="true" type="VARCHAR" size="48"/>
-       <column name="fk_to_B" required="false" type="VARCHAR" size="48"/>
+       <column name="pk" required="true" primaryKey="true" type="VARCHAR" size="150"/>
+       <column name="fk_to_B" required="false" type="VARCHAR" size="150"/>
 <!--
 	BRJ : can't reference a table that is created later
        <foreign-key foreignTable="BIDIR_B">
@@ -389,8 +389,8 @@
    </table>
 
    <table name="BIDIR_B">
-       <column name="pk" required="true" primaryKey="true" type="VARCHAR" size="48"/>
-       <column name="fk_to_A" required="false" type="VARCHAR" size="48"/>
+       <column name="pk" required="true" primaryKey="true" type="VARCHAR" size="150"/>
+       <column name="fk_to_A" required="false" type="VARCHAR" size="150"/>
        <foreign-key foreignTable="BIDIR_A">
          <reference local="fk_to_A" foreign="pk"/>
        </foreign-key>
@@ -423,6 +423,7 @@
     </foreign-key>
   </table>
 
+
   <table name="FISH">
     <column name="foodId" required="true" primaryKey="true" type="INTEGER"/>
     <column name="name" type="VARCHAR" size="60"/>
@@ -713,27 +714,27 @@
     private long uid;  // primary key
     private long node_refid;
     -->
-    <table name="FIELD_CONVERSION_NODE">
+    <table name="FIELDCONV_NODE">
         <column name="NODE_ID" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="NODE_STATE" required="true" primaryKey="true" type="INTEGER"/>
         <column name="PARENT_UID" type="DECIMAL" size="15,0"/>
     </table>
 
-    <table name="FIELD_CONVERSION_NODE_NOINC">
+    <table name="FIELDCONV_NOINC">
         <column name="NODE_ID" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
     </table>
 
     <table name="CONVERSION_VO">
         <column name="PK_WITH_AUTO" required="true" primaryKey="true" type="INTEGER"/>
-        <column name="PK_WITHOUT_AUTO" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="PK_WO_AUTO" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NORMAL_WITH_AUTO" required="false" primaryKey="false" type="INTEGER"/>
-        <column name="NORMAL_WITHOUT_AUTO" required="false" primaryKey="false" type="INTEGER"/>
+        <column name="NORMAL_WO_AUTO" required="false" primaryKey="false" type="INTEGER"/>
     </table>
 
     <!-- =================================================== -->
     <!-- NumberAccuarcyTest                                  -->
     <!-- =================================================== -->
-    <table name="NUMBER_ACCURACY_TEST">
+    <table name="NUMBER_ACCURACY">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="SCALE_TWO" type="DECIMAL" size="15,6"/>
         <column name="SCALE_FOUR" type="DECIMAL" size="15,6"/>
@@ -856,6 +857,7 @@
         </foreign-key>
     </table>
 
+
     <table name="REF_OBJ_A">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
@@ -878,6 +880,7 @@
         <column name="FK_REF" type="INTEGER"/>
     </table>
 
+
     <!-- =================================================== -->
     <!-- PrimaryKeyForeignKeyTest - PB-api                   -->
     <!-- =================================================== -->
@@ -925,13 +928,13 @@
         <column name="FK_REF" type="INTEGER"/>
     </table>
 
-    <table name="READTEST_ADDRESS">
+    <table name="READTEST_ADDR">
         <column name="OJB_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_REF" type="INTEGER"/>
     </table>
 
-    <table name="READTEST_ADDRESS_TYPE">
+    <table name="READTEST_ADDR_TYPE">
         <column name="OJB_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_REF" type="INTEGER"/>
@@ -1061,7 +1064,7 @@
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
 
-    <table name="COL_COLLECTIBLE_A">
+    <table name="COLLECTIBLE_A">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="GAT_ID" type="INTEGER"/>
@@ -1071,7 +1074,7 @@
         </foreign-key>
     </table>
 
-    <table name="COL_COLLECTIBLE_BASE">
+    <table name="COLLECTIBLE_BASE">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="GAT_ID" type="INTEGER"/>
@@ -1081,7 +1084,7 @@
         </foreign-key>
     </table>
 
-    <table name="COL_COLLECTIBLE_B">
+    <table name="COLLECTIBLE_B">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="GAT_ID" type="INTEGER"/>
@@ -1091,7 +1094,7 @@
         </foreign-key>
     </table>
 
-    <table name="COL_COLLECTIBLE_C">
+    <table name="COLLECTIBLE_C">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="GAT_ID" type="INTEGER"/>
@@ -1102,7 +1105,7 @@
         </foreign-key>
     </table>
 
-    <table name="COL_COLLECTIBLE_CC">
+    <table name="COLLECTIBLE_CC">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="GAT_ID" type="INTEGER"/>
@@ -1113,7 +1116,7 @@
         </foreign-key>
     </table>
 
-    <table name="COL_COLLECTIBLE_C2">
+    <table name="COLLECTIBLE_C2">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="GAT_ID" type="INTEGER"/>
@@ -1124,7 +1127,7 @@
         </foreign-key>
     </table>
 
-    <table name="COL_COLLECTIBLE_D">
+    <table name="COLLECTIBLE_D">
         <column name="COL_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="OJB_CONCRETE_CLASS" type="VARCHAR" size="150"/>
@@ -1136,40 +1139,49 @@
     </table>
 
 
-    <table name="COL_2_PROJECT">
+    <table name="COL2_PRJ">
         <column name="PRO_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
-    <table name="COL_2_SUB_PROJECT">
+    <table name="COL2_SUBPRJ">
+        <column name="SUB_ID" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="NAME" type="VARCHAR" size="150"/>
+        <column name="FK_PRO_ID" type="INTEGER"/>
+        <foreign-key foreignTable="COL2_PRJ">
+            <reference local="FK_PRO_ID" foreign="PRO_ID"/>
+        </foreign-key>
+    </table>
+    <table name="COL2_SUBPRJ2">
         <column name="SUB_ID" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="SUB_DATE" required="true" primaryKey="true" type="TIMESTAMP"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_PRO_ID" type="INTEGER"/>
-        <foreign-key foreignTable="COL_2_PROJECT">
+        <foreign-key foreignTable="COL2_PRJ">
             <reference local="FK_PRO_ID" foreign="PRO_ID"/>
         </foreign-key>
     </table>
-    <table name="COL_2_DEVELOPER">
+    <table name="COL2_DEV">
         <column name="DEV_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_PRO_ID" type="INTEGER"/>
-        <foreign-key foreignTable="COL_2_PROJECT">
+        <foreign-key foreignTable="COL2_PRJ">
             <reference local="FK_PRO_ID" foreign="PRO_ID"/>
         </foreign-key>
     </table>
 
-    <table name="COL_2_SUB_PROJECT_SELF">
+    <table name="COL2_SUBPRJ_SELF">
         <column name="SUB_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_PRO_ID" type="INTEGER"/>
-        <foreign-key foreignTable="COL_2_SUB_PROJECT_SELF">
+        <foreign-key foreignTable="COL2_SUBPRJ_SELF">
             <reference local="FK_PRO_ID" foreign="SUB_ID"/>
         </foreign-key>
     </table>
-    <table name="COL_2_DEVELOPER_SELF">
+    <table name="COL2_DEV_SELF">
         <column name="DEV_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_PRO_ID" type="INTEGER"/>
-        <foreign-key foreignTable="COL_2_SUB_PROJECT_SELF">
+        <foreign-key foreignTable="COL2_SUBPRJ_SELF">
             <reference local="FK_PRO_ID" foreign="SUB_ID"/>
         </foreign-key>
     </table>
@@ -1194,7 +1206,6 @@
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
 
-
     <!-- =================================================== -->
     <!-- PB 'readonly' attribute test                        -->
     <!-- =================================================== -->
@@ -1276,11 +1287,20 @@
 
     <table name="COL_BOOKS">
         <column name="PK" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="NAME" type="VARCHAR" size="100"/>
         <column name="BOOKSHELF_FK" required="true" primaryKey="true" type="INTEGER"/>
     </table>
 
     <table name="COL_DVDS">
         <column name="PK" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="NAME" type="VARCHAR" size="100"/>
+        <column name="BOOKSHELF_FK" required="true" primaryKey="true" type="INTEGER"/>
+    </table>
+
+    <table name="COL_CANDIES">
+        <column name="PK" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="NAME" type="VARCHAR" size="150"/>
+        <column name="INGREDIENTS" type="VARCHAR" size="250"/>
         <column name="BOOKSHELF_FK" required="true" primaryKey="true" type="INTEGER"/>
     </table>
 
@@ -1288,14 +1308,14 @@
     <!-- =================================================== -->
     <!-- PB nested fields test                               -->
     <!-- =================================================== -->
-    <table name="NESTED_FIELDS_TAB">
+    <table name="NESTED_TAB">
      <column name="OBJ_ID" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
      <column name="NAME" type="VARCHAR" size="150"/>
      <column name="NESTED_VALUE" type="VARCHAR" size="150"/>
      <column name="NESTED_DESCRIPTION" type="VARCHAR" size="150"/>
    </table>
 
-    <table name="NESTED_FIELDS_ENTRY">
+    <table name="NESTED_ENTRY">
      <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="FK_ID" required="true" type="DECIMAL" size="15,0"/>
      <column name="NAME" type="VARCHAR" size="150"/>
@@ -1322,29 +1342,29 @@
     <!-- =================================================== -->
     <!-- Mapping Classes on Multiple Joined Tables test      -->
     <!-- =================================================== -->
-    <table name="INHERITANCE_COMPANY">
+    <table name="INH_COMPANY">
         <column name="OBJ_ID" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
 
-    <table name="INHERITANCE_ADDRESS">
+    <table name="INH_ADDRESS">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="STREET" type="VARCHAR" size="150"/>
         <column name="FK_EMPLOYEE_1" type="INTEGER"/>
         <column name="FK_EMPLOYEE_2" type="DECIMAL" size="15,0"/>
     </table>
 
-    <table name="INHERITANCE_EMPLOYEE">
+    <table name="INH_EMPLOYEE">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_ADDRESS" type="INTEGER"/>
-        <foreign-key foreignTable="INHERITANCE_ADDRESS">
+        <foreign-key foreignTable="INH_ADDRESS">
     	  <reference local="FK_ADDRESS" foreign="OBJ_ID"/>
 	    </foreign-key>
     </table>
 
-    <table name="INHERITANCE_EXECUTIVE">
+    <table name="INH_EXECUTIVE">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="SUPER_ID" type="INTEGER"/>
@@ -1352,66 +1372,66 @@
         <column name="MANAGER_ID" type="INTEGER"/>
         <column name="MANAGER_ID_2" type="DECIMAL" size="15,0"/>
         <column name="DEPARTMENT" type="VARCHAR" size="150"/>
-        <foreign-key foreignTable="INHERITANCE_EMPLOYEE">
+        <foreign-key foreignTable="INH_EMPLOYEE">
     	  <reference local="SUPER_ID" foreign="OBJ_ID"/>
     	  <reference local="SUPER_ID_2" foreign="OBJ_ID_2"/>
 	    </foreign-key>
     </table>
 
-    <table name="INHERITANCE_MANAGER">
+    <table name="INH_MANAGER">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="FK_CONSORTIUM" type="INTEGER"/>
         <column name="SUPER_ID" type="INTEGER"/>
         <column name="SUPER_ID_2" type="DECIMAL" size="15,0"/>
-        <foreign-key foreignTable="INHERITANCE_EXECUTIVE">
+        <foreign-key foreignTable="INH_EXECUTIVE">
     	  <reference local="SUPER_ID" foreign="OBJ_ID"/>
     	  <reference local="SUPER_ID_2" foreign="OBJ_ID_2"/>
 	    </foreign-key>
     </table>
 
-    <table name="INHERITANCE_SHAREHOLDER">
+    <table name="INH_SHAREHOLDER">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="SHARE_" type="INTEGER"/>
         <column name="SUPER_ID" type="INTEGER"/>
         <column name="SUPER_ID_2" type="DECIMAL" size="15,0"/>
-        <foreign-key foreignTable="INHERITANCE_MANAGER">
+        <foreign-key foreignTable="INH_MANAGER">
     	  <reference local="SUPER_ID" foreign="OBJ_ID"/>
     	  <reference local="SUPER_ID_2" foreign="OBJ_ID_2"/>
 	    </foreign-key>
     </table>
 
-    <table name="INHERITANCE_EMPLOYEE_ADDRESS">
+    <table name="INH_EMPL_ADDR">
         <column name="EMPLOYEE_ID_1" required="true" primaryKey="true" type="INTEGER"/>
         <column name="EMPLOYEE_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
         <column name="ADDRESS_ID" required="true" primaryKey="true" type="INTEGER"/>
     </table>
 
-    <table name="INHERITANCE_CONSORTIUM">
+    <table name="INH_CONSORTIUM">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
 
 
-    <table name="INHERITANCE_ENTITY">
+    <table name="INH_ENTITY">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
 
-    <table name="INHERITANCE_ANIMAL">
+    <table name="INH_ANIMAL">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="WEIGHT" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_PARENT" type="INTEGER"/>
     </table>
 
-    <table name="INHERITANCE_DOG">
+    <table name="INH_DOG">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="LEGS" type="INTEGER"/>
     </table>
 
-     <table name="INHERITANCE_FOOD">
+     <table name="INH_FOOD">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
          <column name="FK_ANIMAL" type="INTEGER"/>
     </table>
@@ -1436,25 +1456,25 @@
     <!-- =================================================== -->
     <!-- Runtime reference setting test                      -->
     <!-- =================================================== -->
-    <table name="RUNTIME_SETTING_ONE">
+    <table name="RUNTIME_ONE">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
     </table>
 
-     <table name="RUNTIME_SETTING_MAIN">
+     <table name="RUNTIME_MAIN">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_REF" type="INTEGER"/>
-         <foreign-key foreignTable="RUNTIME_SETTING_ONE">
+         <foreign-key foreignTable="RUNTIME_ONE">
     	  <reference local="FK_REF" foreign="OBJ_ID"/>
 	    </foreign-key>
     </table>
 
-    <table name="RUNTIME_SETTING_MANY">
+    <table name="RUNTIME_MANY">
         <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
         <column name="NAME" type="VARCHAR" size="150"/>
         <column name="FK_MAIN" type="INTEGER"/>
-        <foreign-key foreignTable="RUNTIME_SETTING_MAIN">
+        <foreign-key foreignTable="RUNTIME_MAIN">
     	  <reference local="FK_MAIN" foreign="OBJ_ID"/>
 	    </foreign-key>
     </table>
@@ -1557,7 +1577,7 @@
         </foreign-key>
     </table>
 
-    <table name="CT_SHOP_DISTRIBUTOR">
+    <table name="CT_SHOP_DIST">
         <column name="SHOP_ID" type="INTEGER"/>
         <column name="DISTRIBUTOR_ID" type="INTEGER"/>
         <foreign-key foreignTable="CT_SHOP">
@@ -1602,6 +1622,9 @@
         </foreign-key>
     </table>
 
+
+
+
     <!-- =================================================== -->
     <!-- Complex test model tables                           -->
     <!-- =================================================== -->
@@ -1817,7 +1840,7 @@
             javaName="minimumStock"/>
     <column name="Auslaufartikel" type="INTEGER"
             javaName="inSelloutArticle"/>
-    <foreign-key foreignTable="Kategorien_2">
+    <foreign-key foreignTable="Kategorien_2" name="Artikel2Kateg2FK">
       	<reference local="KatName" foreign="Kategorie_Name"/>
     </foreign-key>
   </table>
@@ -1889,6 +1912,23 @@
   <table name="Ownable2">
     <column name="id" required="true" primaryKey="true" type="INTEGER"/>
   </table>
+
+  <table name="CONTAINER_TBL">
+        <column name="ID_" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="NAME" type="VARCHAR" size="150"/>
+        <column name="TARGET" type="JAVA_OBJECT"/>
+        <column name="EDITOR" type="JAVA_OBJECT"/>
+  </table>
+
+  <table name="UTC_A">
+        <column name="ID_" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="NAME" type="VARCHAR" size="250"/>
+    </table>
+
+    <table name="UTC_B">
+        <column name="ID_" required="true" primaryKey="true" type="INTEGER"/>
+        <column name="DESCRIPTION" type="VARCHAR" size="250"/>
+    </table>
 
   <table name="DeepInnerClass">
       <column name="id"

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java Sat Jul 15 07:38:14 2006
@@ -42,6 +42,7 @@
 import org.apache.ojb.broker.sequence.NativeIdentifierTest;
 import org.apache.ojb.broker.sequence.SMMultiThreadedTest;
 import org.apache.ojb.broker.sequence.SequenceManagerTest;
+import org.apache.ojb.broker.lob.LOBTest;
 
 /**
  * the facade to all TestCases in this package.
@@ -94,7 +95,6 @@
         suite.addTestSuite(SMMultiThreadedTest.class);
         suite.addTestSuite(KeyConstraintViolationTest.class);
         suite.addTestSuite(RsIteratorTest.class);
-        suite.addTestSuite(BlobTest.class);
         suite.addTestSuite(CharacterTest.class);
         suite.addTestSuite(LogServiceTest.class);
         suite.addTestSuite(MetaDataSerializationTest.class);
@@ -119,9 +119,6 @@
         suite.addTestSuite(AbstractExtentClassTest.class);
         suite.addTestSuite(NestedFieldsTest.class);
         suite.addTestSuite(ReadonlyTest.class);
-        // arminw: this test doesn't pass without failure on all machines
-        // because the behavior of the JVM gc is not predetermined.
-        // suite.addTestSuite(ReferenceMapTest.class);
         suite.addTestSuite(MultithreadedReadTest.class);
         suite.addTestSuite(CollectionTest2.class);
         suite.addTestSuite(NumberAccuracyTest.class);
@@ -147,10 +144,14 @@
         suite.addTestSuite(PicoComponentContainerTest.class);
         suite.addTestSuite(SpringComponentContainerTest.class);
         suite.addTestSuite(NoPkReferenceTest.class);
+        suite.addTestSuite(UnwrapHelperTest.class);
+        suite.addTestSuite(LOBTest.class);
+        suite.addTestSuite(JdbcJavaObjectTest.class);
         suite.addTestSuite(CreationTest.class);
-        
+
         // BRJ: ensure shutdown of hsqldb
-        suite.addTestSuite(HsqldbShutdown.class);        
+        suite.addTestSuite(HsqldbShutdown.class);
         return suite;
     }
+
 }

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/ArticleWithStockDetail.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/ArticleWithStockDetail.java?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/ArticleWithStockDetail.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/ArticleWithStockDetail.java Sat Jul 15 07:38:14 2006
@@ -28,6 +28,6 @@
     /** return a string representation of an article*/
     public String toString()
     {
-        return super.toString() + "stockDetail   " + getStockDetail() + "\n";
+        return super.toString() + " stockDetail: " + getStockDetail();
     }
 }

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/BidirectionalAssociationTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/BidirectionalAssociationTest.java?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/BidirectionalAssociationTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/BidirectionalAssociationTest.java Sat Jul 15 07:38:14 2006
@@ -1,17 +1,19 @@
 package org.apache.ojb.broker;
 
-import java.util.Iterator;
+import java.io.Serializable;
 import java.util.Collection;
+import java.util.Iterator;
 
+import org.apache.ojb.broker.metadata.ClassDescriptor;
+import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.query.QueryFactory;
-import org.apache.ojb.broker.metadata.ClassDescriptor;
-import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
+import org.apache.ojb.broker.util.ObjectModification;
 import org.apache.ojb.junit.PBTestCase;
 
 /**
- * tests a bidirectional association A<-->B
+ * Tests a bidirectional association A<-->B
  * @see org.apache.ojb.odmg.BidirectionalAssociationTest for equivalent test in ODMG
  */
 public class BidirectionalAssociationTest extends PBTestCase
@@ -37,14 +39,227 @@
         super.tearDown();
     }
 
+    public void testCreateDeleteWithAutoincrement_1()
+    {
+        ojbChangeReferenceSetting(ObjectAA.class, "relatedB", true,
+                ObjectReferenceDescriptor.CASCADE_OBJECT, ObjectReferenceDescriptor.CASCADE_OBJECT, false);
+        ojbChangeReferenceSetting(ObjectBB.class, "relatedA", true,
+                ObjectReferenceDescriptor.CASCADE_OBJECT, ObjectReferenceDescriptor.CASCADE_OBJECT, false);
+
+        ObjectAA a = new ObjectAA();
+        ObjectBB b = new ObjectBB();
+        broker.beginTransaction();
+        // first store both objects
+        broker.store(a, ObjectModification.INSERT);
+        broker.store(b, ObjectModification.INSERT);
+        // now set references
+        a.setRelatedB(b);
+        b.setRelatedA(a);
+        // update both
+        broker.store(a, ObjectModification.UPDATE);
+        broker.commitTransaction();
+
+        Criteria crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        Query query = QueryFactory.newQuery(ObjectAA.class, crit);
+        ObjectAA result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNotNull(result_AA);
+        assertNotNull(result_AA.getRelatedB());
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        ObjectBB result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNotNull(result_BB);
+        assertNotNull(result_BB.getRelatedA());
+
+        broker.beginTransaction();
+        // cascade delete enabled, will delete first ObjectAA then ObjectBB
+        broker.delete(b);
+        broker.commitTransaction();
+
+        crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        query = QueryFactory.newQuery(ObjectAA.class, crit);
+        result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNull(result_AA);
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNull(result_BB);
+    }
+
+    public void testCreateDeleteWithAutoincrement_2()
+    {
+        ojbChangeReferenceSetting(ObjectAA.class, "relatedB", true,
+                ObjectReferenceDescriptor.CASCADE_OBJECT, ObjectReferenceDescriptor.CASCADE_NONE, false);
+        ojbChangeReferenceSetting(ObjectBB.class, "relatedA", true,
+                ObjectReferenceDescriptor.CASCADE_OBJECT, ObjectReferenceDescriptor.CASCADE_NONE, false);
+
+        ObjectAA a = new ObjectAA();
+        ObjectBB b = new ObjectBB();
+        // now set references
+        a.setRelatedB(b);
+        b.setRelatedA(a);
+        broker.beginTransaction();
+        // first store both objects
+        broker.store(a);
+        // update b to force OJB to set the FK
+        broker.store(b);
+        broker.commitTransaction();
+
+        Criteria crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        Query query = QueryFactory.newQuery(ObjectAA.class, crit);
+        ObjectAA result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNotNull(result_AA);
+        assertNotNull(result_AA.getRelatedB());
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        ObjectBB result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNotNull(result_BB);
+        assertNotNull(result_BB.getRelatedA());
+
+        broker.beginTransaction();
+        broker.delete(b);
+        broker.delete(a);
+        broker.commitTransaction();
+
+        crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        query = QueryFactory.newQuery(ObjectAA.class, crit);
+        result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNull(result_AA);
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNull(result_BB);
+    }
+
+    public void testCreateDeleteWithAutoincrement_3()
+    {
+        ojbChangeReferenceSetting(ObjectAA.class, "relatedB", true,
+                ObjectReferenceDescriptor.CASCADE_NONE, ObjectReferenceDescriptor.CASCADE_NONE, false);
+        ojbChangeReferenceSetting(ObjectBB.class, "relatedA", true,
+                ObjectReferenceDescriptor.CASCADE_NONE, ObjectReferenceDescriptor.CASCADE_NONE, false);
+
+        ObjectAA a = new ObjectAA();
+        ObjectBB b = new ObjectBB();
+        // now set references
+        a.setRelatedB(b);
+        b.setRelatedA(a);
+        broker.beginTransaction();
+        // first insert a
+        broker.store(a, ObjectModification.INSERT);
+        // link (set FK to a) and insert b
+        broker.serviceBrokerHelper().link(b, true);
+        broker.store(b, ObjectModification.INSERT);
+        // link a (set FK to b)
+        broker.serviceBrokerHelper().link(a, false);
+        // update FK of a
+        broker.store(a, ObjectModification.UPDATE);
+        broker.commitTransaction();
+
+        Criteria crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        Query query = QueryFactory.newQuery(ObjectAA.class, crit);
+        ObjectAA result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNotNull(result_AA);
+        assertNotNull(result_AA.getRelatedB());
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        ObjectBB result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNotNull(result_BB);
+        assertNotNull(result_BB.getRelatedA());
+
+        broker.beginTransaction();
+        // cascade delete enabled
+        broker.delete(b);
+        broker.delete(a);
+        broker.commitTransaction();
+
+        crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        query = QueryFactory.newQuery(ObjectAA.class, crit);
+        result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNull(result_AA);
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNull(result_BB);
+    }
+
+    public void testCreateDeleteWithAutoincrement_4()
+    {
+        ojbChangeReferenceSetting(ObjectAA.class, "relatedB", true,
+                ObjectReferenceDescriptor.CASCADE_LINK, ObjectReferenceDescriptor.CASCADE_NONE, false);
+        ojbChangeReferenceSetting(ObjectBB.class, "relatedA", true,
+                ObjectReferenceDescriptor.CASCADE_LINK, ObjectReferenceDescriptor.CASCADE_NONE, false);
+
+        ObjectAA a = new ObjectAA();
+        ObjectBB b = new ObjectBB();
+        broker.beginTransaction();
+        // first store both objects
+        broker.store(a);
+        broker.store(b);
+        // now set references
+        a.setRelatedB(b);
+        b.setRelatedA(a);
+        // update a and b to force OJB to set the FK
+        broker.store(a);
+        broker.store(b);
+        broker.commitTransaction();
+
+        Criteria crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        Query query = QueryFactory.newQuery(ObjectAA.class, crit);
+        ObjectAA result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNotNull(result_AA);
+        assertNotNull(result_AA.getRelatedB());
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        ObjectBB result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNotNull(result_BB);
+        assertNotNull(result_BB.getRelatedA());
+
+        broker.beginTransaction();
+        broker.delete(b);
+        broker.commitTransaction();
+
+        crit = new Criteria();
+        crit.addLike("pk", a.getPk());
+        query = QueryFactory.newQuery(ObjectAA.class, crit);
+        result_AA = (ObjectAA) broker.getObjectByQuery(query);
+        assertNotNull(result_AA);
+        assertNull(result_AA.getRelatedB());
+
+        crit = new Criteria();
+        crit.addLike("pk", b.getPk());
+        query = QueryFactory.newQuery(ObjectBB.class, crit);
+        result_BB = (ObjectBB) broker.getObjectByQuery(query);
+        assertNull(result_BB);
+    }
+
     public void testAutoRefreshTrue()
     {
-        String pkSuffix = "_" + System.currentTimeMillis();
+        String pkSuffix = "testAutoRefreshTrue_" + System.currentTimeMillis();
         ObjectReferenceDescriptor ord_A = null;
         ObjectReferenceDescriptor ord_B = null;
-        ClassDescriptor cld_A = broker.getClassDescriptor(BidirectionalAssociationObjectA.class);
+        ClassDescriptor cld_A = broker.getClassDescriptor(ObjectA.class);
         ord_A = cld_A.getObjectReferenceDescriptorByName("relatedB");
-        ClassDescriptor cld_B = broker.getClassDescriptor(BidirectionalAssociationObjectB.class);
+        ClassDescriptor cld_B = broker.getClassDescriptor(ObjectB.class);
         ord_B = cld_B.getObjectReferenceDescriptorByName("relatedA");
         boolean oldA = ord_A.isRefresh();
         boolean oldB = ord_B.isRefresh();
@@ -55,7 +270,7 @@
             createWithUpdate(pkSuffix);
             Criteria crit = new Criteria();
             crit.addLike("pk", "%" + pkSuffix);
-            Query query = QueryFactory.newQuery(BidirectionalAssociationObjectB.class, crit);
+            Query query = QueryFactory.newQuery(ObjectB.class, crit);
             Collection result = broker.getCollectionByQuery(query);
             assertEquals(1, result.size());
         }
@@ -66,9 +281,9 @@
         }
     }
 
-    public void testCreateDelete()
+    public void testCreateDeleteDisabledAutoincrement_()
     {
-        String pkSuffix = "_" + System.currentTimeMillis();
+        String pkSuffix = "testCreateDeleteDisabledAutoincrement_" + System.currentTimeMillis();
         createWithUpdate(pkSuffix);
         deleteAllA();
         deleteAllB();
@@ -77,9 +292,9 @@
     private void createWithUpdate(String pkSuffix)
     {
         broker.beginTransaction();
-        BidirectionalAssociationObjectA a = new BidirectionalAssociationObjectA();
+        ObjectA a = new ObjectA();
         a.setPk("A" + pkSuffix);
-        BidirectionalAssociationObjectB b = new BidirectionalAssociationObjectB();
+        ObjectB b = new ObjectB();
         b.setPk("B" + pkSuffix);
         broker.store(a);
         broker.store(b);
@@ -104,12 +319,12 @@
         Criteria crit = new Criteria();
         Query q;
         Iterator iter;
-        q = QueryFactory.newQuery(BidirectionalAssociationObjectA.class, crit);
+        q = QueryFactory.newQuery(ObjectA.class, crit);
         iter = broker.getIteratorByQuery(q);
-        BidirectionalAssociationObjectA temp = null;
+        ObjectA temp = null;
         while (iter.hasNext())
         {
-            temp = (BidirectionalAssociationObjectA) iter.next();
+            temp = (ObjectA) iter.next();
             if (temp.getRelatedB() == null)
             {
                 fail("relatedB not found");
@@ -128,12 +343,12 @@
         Criteria crit = new Criteria();
         Query q;
         Iterator iter;
-        q = QueryFactory.newQuery(BidirectionalAssociationObjectB.class, crit);
+        q = QueryFactory.newQuery(ObjectB.class, crit);
         iter = broker.getIteratorByQuery(q);
-        BidirectionalAssociationObjectB temp = null;
+        ObjectB temp = null;
         while (iter.hasNext())
         {
-            temp = (BidirectionalAssociationObjectB) iter.next();
+            temp = (ObjectB) iter.next();
             if (temp.getRelatedA() == null)
             {
                 fail("relatedA not found");
@@ -165,14 +380,14 @@
         Criteria crit = new Criteria();
         Query q;
         Iterator iter;
-        q = QueryFactory.newQuery(BidirectionalAssociationObjectA.class, crit);
+        q = QueryFactory.newQuery(ObjectA.class, crit);
         iter = broker.getIteratorByQuery(q);
-        BidirectionalAssociationObjectA temp = null;
+        ObjectA temp = null;
         broker.beginTransaction();
         while (iter.hasNext())
         {
-            temp = (BidirectionalAssociationObjectA) iter.next();
-            BidirectionalAssociationObjectB b = temp.getRelatedB();
+            temp = (ObjectA) iter.next();
+            ObjectB b = temp.getRelatedB();
             if (b != null)
             {
                 b.setRelatedA(null);
@@ -183,19 +398,19 @@
         broker.commitTransaction();
     }
 
-   private void deleteAllB()
+    private void deleteAllB()
     {
         Criteria crit = new Criteria();
         Query q;
         Iterator iter;
-        q = QueryFactory.newQuery(BidirectionalAssociationObjectB.class, crit);
+        q = QueryFactory.newQuery(ObjectB.class, crit);
         iter = broker.getIteratorByQuery(q);
-        BidirectionalAssociationObjectB temp = null;
+        ObjectB temp = null;
         broker.beginTransaction();
         while (iter.hasNext())
         {
-            temp = (BidirectionalAssociationObjectB) iter.next();
-            BidirectionalAssociationObjectA a = temp.getRelatedA();
+            temp = (ObjectB) iter.next();
+            ObjectA a = temp.getRelatedA();
             if (a != null)
             {
                 a.setRelatedB(null);
@@ -204,5 +419,114 @@
             broker.delete(temp);
         }
         broker.commitTransaction();
+    }
+
+
+
+
+
+    //===================================================================
+    // inner classes
+    //===================================================================
+
+    /**
+     * with enabled autoincrement
+     */
+    public static class ObjectAA extends ObjectA
+    {
+
+    }
+    /**
+     * with enabled autoincrement
+     */
+    public static class ObjectBB extends ObjectB
+    {
+
+    }
+    /**
+     * with disabled autoincrement
+     */
+    public static class ObjectA implements Serializable
+    {
+        private String pk;
+        private String fkToB;
+        private ObjectB relatedB;
+
+        public ObjectA()
+        {
+        }
+
+        public String getPk()
+        {
+            return pk;
+        }
+
+        public void setPk(String pk)
+        {
+            this.pk = pk;
+        }
+
+        public String getFkToB()
+        {
+            return fkToB;
+        }
+
+        public void setFkToB(String fkToB)
+        {
+            this.fkToB = fkToB;
+        }
+
+        public ObjectB getRelatedB()
+        {
+            return relatedB;
+        }
+
+        public void setRelatedB(ObjectB relatedB)
+        {
+            this.relatedB = relatedB;
+        }
+    }
+    /**
+     * with disabled autoincrement
+     */
+    public static class ObjectB implements Serializable
+    {
+        private String pk;
+        private String fkToA;
+        private ObjectA relatedA;
+
+        public ObjectB()
+        {
+        }
+
+        public String getPk()
+        {
+            return pk;
+        }
+
+        public void setPk(String pk)
+        {
+            this.pk = pk;
+        }
+
+        public String getFkToA()
+        {
+            return fkToA;
+        }
+
+        public void setFkToA(String fkToA)
+        {
+            this.fkToA = fkToA;
+        }
+
+        public ObjectA getRelatedA()
+        {
+            return relatedA;
+        }
+
+        public void setRelatedA(ObjectA relatedA)
+        {
+            this.relatedA = relatedA;
+        }
     }
 }

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest.java?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest.java Sat Jul 15 07:38:14 2006
@@ -9,10 +9,11 @@
 
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
+import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.Query;
-import org.apache.ojb.broker.query.QueryByCriteria;
 import org.apache.ojb.broker.query.QueryFactory;
+import org.apache.ojb.broker.util.ObjectModification;
 import org.apache.ojb.broker.util.collections.RemovalAwareCollection;
 import org.apache.ojb.junit.PBTestCase;
 
@@ -68,12 +69,129 @@
  */
 public class CollectionTest extends PBTestCase
 {
+    static final int NONE = ObjectReferenceDescriptor.CASCADE_NONE;
+    static final int LINK = ObjectReferenceDescriptor.CASCADE_LINK;
+    static final int OBJECT = ObjectReferenceDescriptor.CASCADE_OBJECT;
+
     public static void main(String[] args)
     {
         String[] arr = {CollectionTest.class.getName()};
         junit.textui.TestRunner.main(arr);
     }
 
+    /**
+     * test for OJB-82
+     */
+    public void testUsingExtentWhichIsNotInheritedFromBaseClass() throws Exception
+    {
+        // TODO: fix this bug
+        if(ojbSkipKnownIssueProblem("Test for OJB-82 will be fixed in next version")) return;
+
+        String prefix = "testUsingExtentWhichIsNotInheritedFromBaseClass_" + System.currentTimeMillis();
+
+        ojbChangeReferenceSetting(BookShelf.class, "items", true, OBJECT, OBJECT, false);
+        ojbChangeReferenceSetting(DVD.class, "shelf", true, NONE, NONE, false);
+        ojbChangeReferenceSetting(Book.class, "shelf", true, NONE, NONE, false);
+        ojbChangeReferenceSetting(Candie.class, "shelf", true, NONE, NONE, false);
+
+        BookShelf bookShelf = new BookShelf(prefix);
+        BookShelfItem dvd = new DVD(prefix+ "_dvd", bookShelf);
+        BookShelfItem book = new Book(prefix + "_book", bookShelf);
+        Candie candie = new Candie(prefix + "_book", bookShelf);
+        List items = new ArrayList();
+        items.add(dvd);
+        items.add(book);
+        items.add(candie);
+        bookShelf.setItems(items);
+
+        broker.beginTransaction();
+        broker.store(bookShelf);
+        broker.commitTransaction();
+
+        broker.clearCache();
+        BookShelf loadedCopy = (BookShelf) broker.getObjectByIdentity(
+                broker.serviceIdentity().buildIdentity(BookShelf.class, bookShelf.getPk()));
+        assertNotNull(loadedCopy);
+        assertNotNull(loadedCopy.getItems());
+        assertEquals(3, loadedCopy.getItems().size());
+
+        broker.beginTransaction();
+        broker.clearCache();
+        Criteria criteria = new Criteria();
+        criteria.addLike("name", prefix + "%");
+        Query q = QueryFactory.newQuery(BookShelfItem.class, criteria);
+        Collection result = broker.getCollectionByQuery(q);
+        assertNotNull(result);
+        assertEquals(3, result.size());
+    }
+
+    public void testMoveProxyCollectionFromOneToAnother() throws Exception
+    {
+        String prefix = "testMoveProxyCollectionFromOneToAnother_" + System.currentTimeMillis();
+
+        ojbChangeReferenceSetting(BookShelf.class, "items", true, OBJECT, OBJECT, true);
+        ojbChangeReferenceSetting(DVD.class, "shelf", true, NONE, NONE, true);
+        ojbChangeReferenceSetting(Book.class, "shelf", true, NONE, NONE, true);
+
+        BookShelf bookShelf = new BookShelf(prefix);
+        BookShelf bookShelfSecond = new BookShelf(prefix+"_second");
+        BookShelfItem ev1 = new DVD(prefix+ "_dvd", bookShelf);
+        BookShelfItem ev2 = new Book(prefix + "_book", bookShelf);
+        bookShelf.addItem(ev1);
+        bookShelf.addItem(ev2);
+
+        broker.beginTransaction();
+        broker.store(bookShelfSecond);
+        broker.store(bookShelf);
+        broker.commitTransaction();
+
+        broker.clearCache();
+        BookShelf loadedCopy = (BookShelf) broker.getObjectByIdentity(
+                broker.serviceIdentity().buildIdentity(BookShelf.class, bookShelf.getPk()));
+        assertNotNull(loadedCopy);
+        assertNotNull(loadedCopy.getItems());
+        assertEquals(2, loadedCopy.getItems().size());
+
+        broker.beginTransaction();
+        /*
+        now we move the unmaterialzed proxy collection from one to another object,
+        it's important to first store the bookshelf object with the nullified items
+        and then the bookshelf with moved item collection proxy - otherwise the PB-api
+        doesn't recognize the changes
+        */
+        bookShelfSecond.setItems(bookShelf.getItems());
+        bookShelf.setItems(null);
+        broker.store(bookShelf, ObjectModification.UPDATE);
+        broker.store(bookShelfSecond, ObjectModification.UPDATE);
+        broker.commitTransaction();
+        broker.clearCache();
+
+        loadedCopy = (BookShelf) broker.getObjectByIdentity(
+                broker.serviceIdentity().buildIdentity(BookShelf.class, bookShelf.getPk()));
+        assertNotNull(loadedCopy);
+        assertNotNull(loadedCopy.getItems());
+        assertEquals(0, loadedCopy.getItems().size());
+
+        BookShelf loadedCopySecond = (BookShelf) broker.getObjectByIdentity(
+                broker.serviceIdentity().buildIdentity(BookShelf.class, bookShelfSecond.getPk()));
+        assertNotNull(loadedCopySecond);
+        assertNotNull(loadedCopySecond.getItems());
+        assertEquals(2, loadedCopySecond.getItems().size());
+
+        broker.clearCache();
+        Criteria criteria = new Criteria();
+        criteria.addLike("name", prefix + "%");
+        Query q = QueryFactory.newQuery(BookShelfItem.class, criteria);
+        Collection items = broker.getCollectionByQuery(q);
+        assertNotNull(items);
+        assertEquals(2, items.size());
+        // we are using collection proxies, so we have to use the interface
+        BookShelfItem item = (BookShelfItem) items.iterator().next();
+        assertNotNull(item.getShelf());
+        BookShelfIF bs = item.getShelf();
+        assertEquals(bookShelfSecond.getPk(), bs.getPk());
+    }
+
     public void testReadProxyCollection() throws Exception
     {
         String name = "testReadProxyCollection_"+System.currentTimeMillis();
@@ -150,7 +268,7 @@
         broker.store(gat);
         broker.commitTransaction();
 
-        Identity oid = new Identity(gat, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gat);
         broker.clearCache();
         Gatherer new_gat = (Gatherer) broker.getObjectByIdentity(oid);
         assertNotNull(new_gat);
@@ -214,7 +332,7 @@
         assertEquals("CollectibleB objects", 4, gatherer.getCollectiblesB().size());
         assertEquals(gatherer.getGatId(), ((CollectibleBIF) gatherer.getCollectiblesB().get(0)).getGathererId());
 
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         broker.clearCache();
         Gatherer new_gatherer = (Gatherer) broker.getObjectByIdentity(oid);
 
@@ -316,7 +434,7 @@
         assertEquals("CollectibleB objects", 4, gatherer.getCollectiblesB().size());
         assertEquals(gatherer.getGatId(), ((CollectibleBIF) gatherer.getCollectiblesB().get(0)).getGathererId());
 
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         broker.clearCache();
         Gatherer new_gatherer = (Gatherer) broker.getObjectByIdentity(oid);
 
@@ -419,7 +537,7 @@
         assertEquals(gatherer.getGatId(), ((CollectibleC2) gatherer.getCollectiblesC2().get(0)).getGathererId());
 
         broker.clearCache();
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         gatherer = (Gatherer) broker.getObjectByIdentity(oid);
         assertNotNull(gatherer);
         // auto-retierve is set false
@@ -436,6 +554,12 @@
         // auto-retieve is false, so get references manually
         broker.retrieveAllReferences(gatherer);
         assertNotNull(gatherer.getCollectiblesC2());
+        List colList = gatherer.getCollectiblesC2();
+        for (Iterator iterator = colList.iterator(); iterator.hasNext();)
+        {
+            // delete all references first
+            broker.delete(iterator.next());
+        }
         broker.delete(gatherer);
         broker.commitTransaction();
 
@@ -472,7 +596,7 @@
         assertEquals("CollectibleDD objects", 3, gatherer.getCollectiblesDD().size());
         assertEquals(gatherer.getGatId(), ((CollectibleDDIF) gatherer.getCollectiblesDD().get(0)).getGathererId());
 
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         broker.clearCache();
         Gatherer new_gatherer = (Gatherer) broker.getObjectByIdentity(oid);
 
@@ -575,7 +699,7 @@
         broker.store(gatherer);
         broker.commitTransaction();
 
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         broker.clearCache();
         Gatherer new_gatherer = (Gatherer) broker.getObjectByIdentity(oid);
 
@@ -629,7 +753,7 @@
         broker.store(gatherer);
         broker.commitTransaction();
 
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         broker.clearCache();
         Gatherer new_gatherer = (Gatherer) broker.getObjectByIdentity(oid);
 
@@ -696,7 +820,7 @@
         assertTrue(gatherer.getCollectiblesC().size() > 0);
         assertEquals(gatherer.getGatId(), ((CollectibleCIF) gatherer.getCollectiblesC().get(0)).getGathererId());
 
-        Identity oid = new Identity(gatherer, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(gatherer);
         broker.clearCache();
         Gatherer new_gatherer = (Gatherer) broker.getObjectByIdentity(oid);
 
@@ -737,11 +861,11 @@
         broker.store(ev1);
         broker.store(ev2);
         broker.commitTransaction();
-        assertTrue(bookShelf.getPK() != null);
+        assertTrue(bookShelf.getPk() != null);
 
         broker.clearCache();
         BookShelf loadedCopy = (BookShelf) broker.getObjectByIdentity(
-                new Identity(BookShelf.class, BookShelf.class, new Object[]{bookShelf.getPK()}));
+                broker.serviceIdentity().buildIdentity(BookShelf.class, bookShelf.getPk()));
         assertNotNull(loadedCopy);
         assertNotNull(loadedCopy.getItems());
         assertEquals(2, loadedCopy.getItems().size());
@@ -753,9 +877,10 @@
         Collection books = broker.getCollectionByQuery(q);
         assertNotNull(books);
         assertEquals(1, books.size());
-        bookShelf = (BookShelf) books.iterator().next();
-        assertNotNull(bookShelf.getItems());
-        assertEquals("wrong number of items found", 2, bookShelf.getItems().size());
+        // we are using collection proxies, so we have to use the interface
+        BookShelfIF bookShelfIF = (BookShelfIF) books.iterator().next();
+        assertNotNull(bookShelfIF.getItems());
+        assertEquals("wrong number of items found", 2, bookShelfIF.getItems().size());
     }
 
     public void testOneBookShelfQueryByIterator() throws Exception
@@ -774,11 +899,11 @@
         broker.store(ev2);
         broker.commitTransaction();
 
-        assertTrue(bookShelf.getPK() != null);
+        assertTrue(bookShelf.getPk() != null);
 
         broker.clearCache();
         BookShelf loadedCopy = (BookShelf) broker.getObjectByIdentity(
-                new Identity(BookShelf.class, BookShelf.class, new Object[]{bookShelf.getPK()}));
+                broker.serviceIdentity().buildIdentity(BookShelf.class, bookShelf.getPk()));
         assertNotNull(loadedCopy);
         assertNotNull(loadedCopy.getItems());
         assertEquals(2, loadedCopy.getItems().size());
@@ -964,78 +1089,71 @@
 
     private CollectibleBase[] prepareCollectibleBase(String namePrefix)
     {
-        CollectibleBase[] colA = new CollectibleBase[]{
+        return new CollectibleBase[]{
             new CollectibleBase(namePrefix + "_colBase_1"),
             new CollectibleBase(namePrefix + "_colBase_2"),
             new CollectibleBase(namePrefix + "_colBase_3")
         };
-        return colA;
     }
 
     private CollectibleB[] prepareCollectibleB(String namePrefix)
     {
-        CollectibleB[] colB = new CollectibleB[]{
+        return new CollectibleB[]{
             new CollectibleB(namePrefix + "_colB_1"),
             new CollectibleB(namePrefix + "_colB_2"),
             new CollectibleB(namePrefix + "_colB_3"),
             new CollectibleB(namePrefix + "_colB_4")
         };
-        return colB;
     }
 
     private CollectibleC[] prepareCollectibleC(String namePrefix)
     {
-        CollectibleC[] colC = new CollectibleC[]{
+        return new CollectibleC[]{
             new CollectibleC(namePrefix + "_colC_1", "ext1"),
             new CollectibleC(namePrefix + "_colC_2", "ext2"),
             new CollectibleC(namePrefix + "_colC_3", "ext3"),
             new CollectibleC(namePrefix + "_colC_4", "ext4"),
             new CollectibleC(namePrefix + "_colC_5", "ext5")
         };
-        return colC;
     }
 
     private CollectibleCC[] prepareCollectibleCC(String namePrefix)
     {
-        CollectibleCC[] colCC = new CollectibleCC[]{
+        return new CollectibleCC[]{
             new CollectibleCC(namePrefix + "_colCC_1", "ext1"),
             new CollectibleCC(namePrefix + "_colCC_2", "ext2"),
             new CollectibleCC(namePrefix + "_colCC_3", "ext3"),
             new CollectibleCC(namePrefix + "_colCC_4", "ext4"),
             new CollectibleCC(namePrefix + "_colCC_5", "ext5")
         };
-        return colCC;
     }
 
     private CollectibleC2[] prepareCollectibleC2(String namePrefix)
     {
-        CollectibleC2[] colCC = new CollectibleC2[]{
+        return new CollectibleC2[]{
             new CollectibleC2(namePrefix + "_colC2_1", "ext1"),
             new CollectibleC2(namePrefix + "_colC2_2", "ext2"),
             new CollectibleC2(namePrefix + "_colC2_3", "ext3"),
             new CollectibleC2(namePrefix + "_colC2_4", "ext4"),
             new CollectibleC2(namePrefix + "_colC2_5", "ext5")
         };
-        return colCC;
     }
 
     private CollectibleD[] prepareCollectibleD(String namePrefix)
     {
-        CollectibleD[] colD = new CollectibleD[]{
+        return new CollectibleD[]{
             new CollectibleD(namePrefix + "_colD_1"),
             new CollectibleD(namePrefix + "_colD_2"),
         };
-        return colD;
     }
 
     private CollectibleDD[] prepareCollectibleDD(String namePrefix)
     {
-        CollectibleDD[] colDD = new CollectibleDD[]{
+        return new CollectibleDD[]{
             new CollectibleDD(namePrefix + "_colDD_1"),
             new CollectibleDD(namePrefix + "_colDD_2"),
             new CollectibleDD(namePrefix + "_colDD_3")
         };
-        return colDD;
     }
 
 
@@ -1454,8 +1572,18 @@
         }
     }
 
+    public static interface BookShelfIF
+    {
+        public void addItem(BookShelfItem event);
+        public List getItems();
+        public Integer getPk();
+        public void setPk(Integer pk);
+        public String getName();
+        public void setName(String name);
+    }
+
 
-    public static class BookShelf
+    public static class BookShelf implements BookShelfIF
     {
         private Integer pk;
         private String name;
@@ -1470,11 +1598,6 @@
             this.name = name;
         }
 
-        public Integer getPK()
-        {
-            return pk;
-        }
-
         public void addItem(BookShelfItem event)
         {
             if (items == null)
@@ -1483,6 +1606,11 @@
             items.add(event);
         }
 
+        public void setItems(List items)
+        {
+            this.items = items;
+        }
+
         public List getItems()
         {
             return items;
@@ -1512,14 +1640,21 @@
     public static abstract class BookShelfItem
     {
         private Integer pk;
-        private BookShelf shelf;
+        private String name;
+        private BookShelfIF shelf;
 
         public BookShelfItem()
         {
         }
 
-        public BookShelfItem(BookShelf shelf)
+        public BookShelfItem(BookShelfIF shelf)
+        {
+            this.shelf = shelf;
+        }
+
+        protected BookShelfItem(String name, BookShelfIF shelf)
         {
+            this.name = name;
             this.shelf = shelf;
         }
 
@@ -1533,12 +1668,22 @@
             this.pk = pk;
         }
 
-        public BookShelf getShelf()
+        public String getName()
+        {
+            return name;
+        }
+
+        public void setName(String name)
+        {
+            this.name = name;
+        }
+
+        public BookShelfIF getShelf()
         {
             return shelf;
         }
 
-        public void setShelf(BookShelf shelf)
+        public void setShelf(BookShelfIF shelf)
         {
             this.shelf = shelf;
         }
@@ -1554,6 +1699,11 @@
         {
             super(shelf);
         }
+
+        public DVD(String name, BookShelfIF shelf)
+        {
+            super(name, shelf);
+        }
     }
 
     public static class Book extends BookShelfItem
@@ -1562,9 +1712,77 @@
         {
         }
 
-        public Book(BookShelf shelf)
+        public Book(BookShelfIF shelf)
         {
             super(shelf);
+        }
+
+        public Book(String name, BookShelfIF shelf)
+        {
+            super(name, shelf);
+        }
+    }
+
+     public static class Candie
+    {
+        private Integer pk;
+        private String name;
+        private String ingredients;
+        private BookShelfIF shelf;
+
+        public Candie()
+        {
+        }
+
+        public Candie(BookShelfIF shelf)
+        {
+            this.shelf = shelf;
+        }
+
+        protected Candie(String name, BookShelfIF shelf)
+        {
+            this.name = name;
+            this.shelf = shelf;
+        }
+
+        public Integer getPk()
+        {
+            return pk;
+        }
+
+        public void setPk(Integer pk)
+        {
+            this.pk = pk;
+        }
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public void setName(String name)
+        {
+            this.name = name;
+        }
+
+        public String getIngredients()
+        {
+            return ingredients;
+        }
+
+        public void setIngredients(String ingredients)
+        {
+            this.ingredients = ingredients;
+        }
+
+        public BookShelfIF getShelf()
+        {
+            return shelf;
+        }
+
+        public void setShelf(BookShelfIF shelf)
+        {
+            this.shelf = shelf;
         }
     }
 }

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest2.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest2.java?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest2.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/CollectionTest2.java Sat Jul 15 07:38:14 2006
@@ -1,6 +1,7 @@
 package org.apache.ojb.broker;
 
 import java.io.Serializable;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -48,6 +49,46 @@
         super.tearDown();
     }
 
+    public void testQueryJoinOneToN() throws Exception
+    {
+        String name = "testQueryJoinOneToN_" + System.currentTimeMillis();
+
+        changeAutoSetting(Project.class, "subProjects", true, true, false, false);
+        changeAutoSetting(Project.class, "subProject_2s", true, true, false, false);
+        changeAutoSetting(Project.class, "developers", true, true, false, false);
+        changeAutoSetting(SubProject.class, "project", true, true, false, false);
+
+        Project project = new Project(name, null, null);
+
+        Timestamp t1 = new Timestamp(System.currentTimeMillis());
+        Timestamp t2 = new Timestamp(t1.getTime() + 1);
+        broker.beginTransaction();
+        // first store the project to assign the PK
+        broker.store(project);
+
+        // now we can use the project id as part of the compounded SubProject_2 PK (id, date)
+        SubProject_2 sub_1 = new SubProject_2(project.getId(), t1, name + "_dvd", project);
+        SubProject_2 sub_2 = new SubProject_2(project.getId(), t2, name + "_book", project);
+        project.addSubProject_2(sub_1);
+        project.addSubProject_2(sub_2);
+        broker.store(project);
+
+        broker.commitTransaction();
+
+        broker.beginTransaction();
+        broker.clearCache();
+        Criteria criteria = new Criteria();
+        criteria.addBetween("subProject_2s.date", new Timestamp(t1.getTime() - 1), new Timestamp(t2.getTime() + 1));
+        Query q = QueryFactory.newQuery(Project.class, criteria, true);
+        Collection projects = broker.getCollectionByQuery(q);
+        assertNotNull(projects);
+        assertEquals(1, projects.size());
+        Project newProject = (Project) projects.iterator().next();
+        assertNotNull(newProject.getSubProjects());
+        assertEquals(2, newProject.getSubProject_2s().size());
+    }
+
+
     public void testAutoUpdateDeleteSettings()
     {
         changeAutoSetting(Project.class, "subProjects", false, false, false, false);
@@ -285,7 +326,6 @@
 
         Identity proOid = broker.serviceIdentity().buildIdentity(pro);
         Project newPro = (Project) broker.getObjectByIdentity(proOid);
-
         assertNotNull(newPro.getDevelopers());
         assertNotNull(newPro.getSubProjects());
         assertEquals(2, newPro.getDevelopers().size());
@@ -751,9 +791,8 @@
         result = broker.getCollectionByQuery(queryByDeveloper);
         assertEquals(2, result.size());
 
-        // generates INNER joins between COL_2_SUB_PROJECT_SELF and COL_2_SUB_PROJECT_SELF and COL_2_DEVELOPER_SELF 
-        QueryByCriteria queryBySubDeveloper = createQueryFor(SubProjectSelfRef.class, "subProjects.developers.name",
-                dev3.getName());
+        // generates OUTER joins between COL_2_SUB_PROJECT_SELF and COL_2_SUB_PROJECT_SELF and COL_2_DEVELOPER_SELF
+        QueryByCriteria queryBySubDeveloper = createQueryFor(SubProjectSelfRef.class, "subProjects.developers.name", dev3.getName());
         queryBySubDeveloper.setDistinct(true);
         result = broker.getCollectionByQuery(queryBySubDeveloper);
         assertEquals(1, result.size());
@@ -824,6 +863,7 @@
         private Integer id;
         private String name;
         private List subProjects;
+        private List subProject_2s;
         private Collection developers;
 
         public Project()
@@ -867,6 +907,34 @@
             this.subProjects = subProjects;
         }
 
+        public void addSubProject(SubProjectIF subProject)
+        {
+            if(subProjects == null)
+            {
+                subProjects = new ArrayList();
+            }
+            subProjects.add(subProject);
+        }
+
+        public List getSubProject_2s()
+        {
+            return subProject_2s;
+        }
+
+        public void setSubProject_2s(List subProject_2s)
+        {
+            this.subProject_2s = subProject_2s;
+        }
+
+        public void addSubProject_2(SubProject_2 subProject2)
+        {
+            if(subProject_2s == null)
+            {
+                subProject_2s = new ArrayList();
+            }
+            subProject_2s.add(subProject2);
+        }
+
         public Collection getDevelopers()
         {
             return developers;
@@ -886,6 +954,7 @@
         public void setName(String name);
         public List getSubProjects();
         public void setSubProjects(List subProjects);
+        public void addSubProject(SubProjectIF subProject);
         public Collection getDevelopers();
         public void setDevelopers(Collection developers);
     }
@@ -937,16 +1006,6 @@
         }
     }
 
-    public static interface SubProjectIF extends Serializable
-    {
-        public Integer getId();
-        public void setId(Integer id);
-        public String getName();
-        public void setName(String name);
-        public ProjectIF getProject();
-        public void setProject(ProjectIF project);
-    }
-
     public static class SubProjectSelfRef
     {
         private Integer id;
@@ -983,28 +1042,103 @@
             this.name = name;
         }
 
-        private Collection getDevelopers()
+        public List getSubProjects()
+        {
+            return subProjects;
+        }
+
+        public void setSubProjects(List subProjects)
+        {
+            this.subProjects = subProjects;
+        }
+
+        public Collection getDevelopers()
         {
             return developers;
         }
 
-        private void setDevelopers(Collection developers)
+        public void setDevelopers(Collection developers)
         {
             this.developers = developers;
         }
+    }
 
-        private List getSubProjects()
+    public static class SubProject_2
+        {
+        private Integer id;
+        private Timestamp date;
+        private String name;
+        private ProjectIF project;
+
+        public SubProject_2()
         {
-            return subProjects;
         }
 
-        private void setSubProjects(List subProjects)
+        public SubProject_2(Integer id, Timestamp date)
         {
-            this.subProjects = subProjects;
+            this.id = id;
+            this.date = date;
         }
+
+        public SubProject_2(Integer id, Timestamp date, String name, ProjectIF project)
+        {
+            this.id = id;
+            this.date = date;
+            this.name = name;
+            this.project = project;
     }
     
-   
+        public Integer getId()
+        {
+            return id;
+        }
+
+        public void setId(Integer id)
+        {
+            this.id = id;
+        }
+
+        public Timestamp getDate()
+        {
+            return date;
+        }
+
+        public void setDate(Timestamp date)
+        {
+            this.date = date;
+        }
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public void setName(String name)
+        {
+            this.name = name;
+        }
+
+        public ProjectIF getProject()
+        {
+            return project;
+        }
+
+        public void setProject(ProjectIF project)
+        {
+            this.project = project;
+        }
+    }
+
+    public static interface SubProjectIF extends Serializable
+    {
+        public Integer getId();
+        public void setId(Integer id);
+        public String getName();
+        public void setName(String name);
+        public ProjectIF getProject();
+        public void setProject(ProjectIF project);
+    }
+
     public static class Developer implements Serializable
     {
         private Integer id;

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/Container.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/Container.java?rev=422236&r1=422235&r2=422236&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/Container.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/Container.java Sat Jul 15 07:38:14 2006
@@ -37,19 +37,54 @@
         this.name = name;
 	}
 
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId(Integer id)
+    {
+        this.id = id;
+    }
+
+    public Integer getParentId()
+    {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId)
+    {
+        this.parentId = parentId;
+    }
+
     public String getName()
     {
         return name;
     }
 
-    public List getChildren()
+    public void setName(String name)
     {
-        return children;
+        this.name = name;
     }
 
     public Container getParent()
     {
         return parent;
+    }
+
+    public void setParent(Container parent)
+    {
+        this.parent = parent;
+    }
+
+    public List getChildren()
+    {
+        return children;
+    }
+
+    public void setChildren(List children)
+    {
+        this.children = children;
     }
 
     public void addChild(Container child)



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message