db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_junit.xml repository_junit_odmg.xml repository_junit_reference.xml
Date Mon, 14 Nov 2005 00:36:12 GMT
arminw      2005/11/13 16:36:12

  Modified:    src/java/org/apache/ojb/broker/util ObjectModification.java
               src/schema ojbtest-data-new.xml ojbtest-data.dtd
                        ojbtest-data.xml ojbtest-schema.xml
               src/test/org/apache/ojb/broker AllTests.java Area.java
                        ExtentAwarePathExpressionsTest.java M2NTest.java
                        PersistenceBrokerTest.java
               src/test/org/apache/ojb/odmg M2NTest.java
               src/test/org/apache/ojb repository_junit.xml
                        repository_junit_odmg.xml
                        repository_junit_reference.xml
  Added:       src/test/org/apache/ojb/broker EmptyTableTest.java
                        TopicExt.java
  Log:
  merge with 1.0.x branch
  add new class TopicExt, table and test data to extend tests in ExtentAwarePathExpressionsTest (OJB-50)
  add test for OJB-76
  add new test case to check behavior of OJB when do queries against empty DB table
  shorten table names from M2N_Test_.... to M2N_...
  
  Revision  Changes    Path
  1.7       +42 -5     db-ojb/src/java/org/apache/ojb/broker/util/ObjectModification.java
  
  Index: ObjectModification.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/ObjectModification.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ObjectModification.java	4 Apr 2004 23:53:37 -0000	1.6
  +++ ObjectModification.java	14 Nov 2005 00:36:10 -0000	1.7
  @@ -15,6 +15,8 @@
    * limitations under the License.
    */
   
  +import java.io.Serializable;
  +
   /**
    *
    * The Interface ObjectModification represents information about
  @@ -25,15 +27,50 @@
    * @author Thomas Mahler
    * @version $Id$
    */
  -public interface ObjectModification extends java.io.Serializable
  +public interface ObjectModification extends Serializable
   {
  -	static final long serialVersionUID = -3208237880606252967L;    /**
  -     * returns true if the underlying Object needs an INSERT statement.
  +	static final long serialVersionUID = -3208237880606252967L;
  +
  +    /**
  +     * Default implementation of this interface usable for INSERT.
  +     */
  +    public static final ObjectModification INSERT = new ObjectModification()
  +    {
  +        public boolean needsInsert()
  +        {
  +            return true;
  +        }
  +
  +        public boolean needsUpdate()
  +        {
  +            return false;
  +        }
  +    };
  +
  +    /**
  +     * Default implementation of this interface usable for UPDATE.
  +     */
  +    public static final ObjectModification UPDATE = new ObjectModification()
  +    {
  +        public boolean needsInsert()
  +        {
  +            return false;
  +        }
  +
  +        public boolean needsUpdate()
  +        {
  +            return true;
  +        }
  +    };
  +
  +    /**
  +     * Returns true if the underlying Object needs an INSERT statement.
        * else Returns false.
        */
       public boolean needsInsert();
  +
       /**
  -     * returns true if the underlying Object needs an UPDATE statement.
  +     * Returns true if the underlying Object needs an UPDATE statement.
        * else Returns false.
        */
       public boolean needsUpdate();
  
  
  
  1.4       +13 -8     db-ojb/src/schema/ojbtest-data-new.xml
  
  Index: ojbtest-data-new.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-data-new.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ojbtest-data-new.xml	13 Nov 2004 16:21:18 -0000	1.3
  +++ ojbtest-data-new.xml	14 Nov 2005 00:36:11 -0000	1.4
  @@ -163,8 +163,8 @@
       <Repository_SMMaxA id="121" name="A"/>
       <Repository_SMMaxAA id="101" name="AA"/>
       <Repository_SMMaxAA id="102" name="AA"/>
  -    <Repository_SMMaxAAA id="123" name="AAA"/>
       <Repository_SMMaxAB id="99" name="AB"/>
  +    <Repository_SMMaxAAA id="123" name="AAA"/>
       <Repository_SMMaxB id="115" name="B"/>
       <Repository_SMMaxB id="116" name="B"/>
       <Repository_SMMaxBB id="130" name="BB"/>
  @@ -174,24 +174,29 @@
       <News id="2" headline="Ferrai for sale (CARS - BUYERS)"/>
       <News id="3" headline="Brazil World Cup Champion ! (SPORTS)"/>
   
  -    <Paper id="10" date="today" author="NONE"/>
  -    <Paper id="11" date="yesterday" author="SALES MAN"/>
  +    <Paper id="10" headline="NONE" issuedate="today" author="NONE"/>
  +    <Paper id="11" headline="SALES" issuedate="yesterday" author="SALES MAN"/>
   
  -    <Category id="1" name="Cars" />
  -    <Category id="2" name="Sports" />
  +    <Topic id="10" name="Buyers" importance="important"/>
  +    <Topic id="11" name="Sellers" importance="unimportant"/>
   
  -    <Topic id="10" name="Buyers" />
  -    <Topic id="11" name="Sellers" />
  +    <TopicExt id="30" name="Buyers_Ext" importance="important" Description="The buyer"/>
  +    <TopicExt id="31" name="Sellers_Ext" importance="unimportant" Description="The seller"/>
  +
  +    <Category id="1" name="Cars" description="The cars category"/>
  +    <Category id="2" name="Sports"/>
   
       <Area id="20" name="Human"/>
       <Area id="21" name="NotHuman"/>
   
       <CONTENT_QUALIFIER CONTENT_ID="2" QUALIFIER_ID="1"/>
       <CONTENT_QUALIFIER CONTENT_ID="2" QUALIFIER_ID="10"/>
  +    <CONTENT_QUALIFIER CONTENT_ID="2" QUALIFIER_ID="30"/>
       <CONTENT_QUALIFIER CONTENT_ID="3" QUALIFIER_ID="2"/>
       <CONTENT_QUALIFIER CONTENT_ID="10" QUALIFIER_ID="20"/>
       <CONTENT_QUALIFIER CONTENT_ID="11" QUALIFIER_ID="11"/>
  -    
  +    <CONTENT_QUALIFIER CONTENT_ID="11" QUALIFIER_ID="31"/>
  +
      	<InitializableObject Id="1"/>
   	<InitializableObject Id="2"/>
   </dataset>
  \ No newline at end of file
  
  
  
  1.19      +11 -0     db-ojb/src/schema/ojbtest-data.dtd
  
  Index: ojbtest-data.dtd
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-data.dtd,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ojbtest-data.dtd	11 Mar 2005 17:18:00 -0000	1.18
  +++ ojbtest-data.dtd	14 Nov 2005 00:36:11 -0000	1.19
  @@ -70,6 +70,7 @@
       News|
       Paper|
       Topic|
  +    TopicExt|
       Category|
       Area|
       ContentQualifier|
  @@ -603,12 +604,22 @@
   <!ATTLIST Topic
       Id CDATA #REQUIRED
       Name CDATA #IMPLIED
  +  Importance CDATA #IMPLIED
  +>
  +
  +<!ELEMENT TopicExt EMPTY>
  +<!ATTLIST TopicExt
  +    Id CDATA #REQUIRED
  +    Name CDATA #IMPLIED
  +  Importance CDATA #IMPLIED
  +  Description CDATA #IMPLIED
   >
   
   <!ELEMENT Category EMPTY>
   <!ATTLIST Category
       Id CDATA #REQUIRED
       Name CDATA #IMPLIED
  +  Description CDATA #IMPLIED
   >
   
   <!ELEMENT Area EMPTY>
  
  
  
  1.21      +8 -3      db-ojb/src/schema/ojbtest-data.xml
  
  Index: ojbtest-data.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-data.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ojbtest-data.xml	12 Nov 2005 18:17:56 -0000	1.20
  +++ ojbtest-data.xml	14 Nov 2005 00:36:11 -0000	1.21
  @@ -183,8 +183,11 @@
       <Paper Id="10" Headline="NONE" Issuedate="today" Author="NONE"/>
       <Paper Id="11" Headline="SALES" Issuedate="yesterday" Author="SALES MAN"/>
   
  -    <Topic Id="10" Name="Buyers"/>
  -    <Topic Id="11" Name="Sellers"/>
  +    <Topic Id="10" Name="Buyers" Importance="important"/>
  +    <Topic Id="11" Name="Sellers" Importance="unimportant"/>
  +
  +    <TopicExt Id="30" Name="Buyers_Ext" Importance="important" Description="The buyer"/>
  +    <TopicExt Id="31" Name="Sellers_Ext" Importance="unimportant" Description="The seller"/>
   
       <Category Id="1" Name="Cars" Description="The cars category"/>
       <Category Id="2" Name="Sports"/>
  @@ -194,10 +197,12 @@
   
       <ContentQualifier ContentId="2" QualifierId="1"/>
       <ContentQualifier ContentId="2" QualifierId="10"/>
  +    <ContentQualifier ContentId="2" QualifierId="30"/>
       <ContentQualifier ContentId="3" QualifierId="2"/>
       <ContentQualifier ContentId="10" QualifierId="20"/>
       <ContentQualifier ContentId="11" QualifierId="11"/>
  +    <ContentQualifier ContentId="11" QualifierId="31"/>
   
  -	<InitializableObject Id="1"/>
  +    <InitializableObject Id="1"/>
   	<InitializableObject Id="2"/>
   </dataset>
  
  
  
  1.104     +44 -10    db-ojb/src/schema/ojbtest-schema.xml
  
  Index: ojbtest-schema.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-schema.xml,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- ojbtest-schema.xml	4 Nov 2005 13:10:12 -0000	1.103
  +++ ojbtest-schema.xml	14 Nov 2005 00:36:11 -0000	1.104
  @@ -519,6 +519,14 @@
     </table>
   
     <!-- Qualifier -->
  +  <table name="TOPIC_EXT">
  +    <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
  +    <column name="NAME" type="VARCHAR" size="50"/>
  +    <column name="IMPORTANCE" type="VARCHAR" size="50"/>
  +      <column name="DESCRIPTION" type="VARCHAR" size="50"/>
  +  </table>
  +
  +  <!-- Qualifier -->
     <table name="CATEGORY">
       <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
       <column name="NAME" type="VARCHAR" size="50"/>
  @@ -529,6 +537,7 @@
     <table name="AREA">
       <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
       <column name="NAME" type="VARCHAR" size="50"/>
  +    <column name="DESCRIPTION" type="VARCHAR" size="50"/>
     </table>
   
     <!-- Cant have foreign keys -->
  @@ -931,13 +940,13 @@
       <!-- =================================================== -->
       <!-- PB M2NTest tables                                   -->
       <!-- =================================================== -->
  -    <table name="M2N_TEST_ACTOR">
  +    <table name="M2N_ACTOR">
           <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
           <column name="OBJ_ID2" required="true" primaryKey="true" type="INTEGER"/>
           <column name="NAME" type="VARCHAR" size="150"/>
       </table>
   
  -    <table name="M2N_TEST_MOVIE">
  +    <table name="M2N_MOVIE">
           <column name="OBJ_ID_INT" required="true" primaryKey="true" type="INTEGER"/>
           <column name="OBJ_ID2_INT" required="true" primaryKey="true" type="INTEGER"/>
           <column name="OBJ_ID_STR" required="true" primaryKey="true" type="VARCHAR" size="150"/>
  @@ -945,40 +954,60 @@
           <column name="DESCRIPTION" type="VARCHAR" size="250"/>
       </table>
   
  -    <table name="M2N_TEST_ROLE">
  +    <table name="M2N_ROLE">
           <column name="ACTOR_ID" required="true" primaryKey="true" type="INTEGER"/>
           <column name="ACTOR_ID2" required="true" primaryKey="true" type="INTEGER"/>
           <column name="MOVIE_ID_INT" required="true" primaryKey="true" type="INTEGER"/>
           <column name="MOVIE_ID2_INT" required="true" primaryKey="true" type="INTEGER"/>
           <column name="MOVIE_ID_STR" required="true" primaryKey="true" type="VARCHAR" size="150"/>
  -        <foreign-key foreignTable="M2N_TEST_ACTOR">
  +        <foreign-key foreignTable="M2N_ACTOR">
               <reference local="ACTOR_ID" foreign="OBJ_ID"/>
               <reference local="ACTOR_ID2" foreign="OBJ_ID2"/>
           </foreign-key>
  -        <foreign-key foreignTable="M2N_TEST_MOVIE">
  +        <foreign-key foreignTable="M2N_MOVIE">
               <reference local="MOVIE_ID_INT" foreign="OBJ_ID_INT"/>
               <reference local="MOVIE_ID2_INT" foreign="OBJ_ID2_INT"/>
               <reference local="MOVIE_ID_STR" foreign="OBJ_ID_STR"/>
           </foreign-key>
       </table>
   
  -    <table name="M2N_TEST_ROLE_2">
  +    <table name="M2N_ROLE_2">
           <column name="ACTOR_ID" required="true" primaryKey="true" type="INTEGER"/>
           <column name="ACTOR_ID2" required="true" primaryKey="true" type="INTEGER"/>
           <column name="MOVIE_ID_INT" required="true" primaryKey="true" type="INTEGER"/>
           <column name="MOVIE_ID2_INT" required="true" primaryKey="true" type="INTEGER"/>
           <column name="MOVIE_ID_STR" required="true" primaryKey="true" type="VARCHAR" size="150"/>
  -        <foreign-key foreignTable="M2N_TEST_ACTOR">
  +        <foreign-key foreignTable="M2N_ACTOR">
               <reference local="ACTOR_ID" foreign="OBJ_ID"/>
               <reference local="ACTOR_ID2" foreign="OBJ_ID2"/>
           </foreign-key>
  -        <foreign-key foreignTable="M2N_TEST_MOVIE">
  +        <foreign-key foreignTable="M2N_MOVIE">
               <reference local="MOVIE_ID_INT" foreign="OBJ_ID_INT"/>
               <reference local="MOVIE_ID2_INT" foreign="OBJ_ID2_INT"/>
               <reference local="MOVIE_ID_STR" foreign="OBJ_ID_STR"/>
           </foreign-key>
       </table>
   
  +    <table name="M2N_PRODUCER">
  +        <column name="ID_" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="ID_STR" required="true" primaryKey="true" type="VARCHAR" size="150"/>
  +        <column name="NAME" type="VARCHAR" size="150"/>
  +    </table>
  +
  +    <table name="M2N_MOVIE_PRODUCER">
  +        <!-- The ID_STR column is used by both table M2N_MOVIE and M2N_PRODUCER -->
  +        <column name="PRODUCER_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="MOVIE_ID_INT" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="MOVIE_ID2_INT" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="ID_STR_SHARED" required="true" primaryKey="true" type="VARCHAR" size="150"/>
  +        <!--<foreign-key foreignTable="M2N_PRODUCER">-->
  +            <!--<reference local="PRODUCER_ID" foreign="ID_"/>-->
  +        <!--</foreign-key>-->
  +        <!--<foreign-key foreignTable="M2N_MOVIE">-->
  +            <!--<reference local="MOVIE_ID_INT" foreign="OBJ_ID_INT"/>-->
  +            <!--<reference local="MOVIE_ID2_INT" foreign="OBJ_ID2_INT"/>-->
  +        <!--</foreign-key>-->
  +    </table>
   
       <table name="M2N_OFFICE">
           <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  @@ -1721,7 +1750,12 @@
       <column name="D_ATTRIB" type="INTEGER" required="false"/>
     </table>
   
  -	<!-- ************ Object Factory tests * START -->
  +    <table name="EMPTY_TABLE">
  +        <column name="ID_" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="250"/>
  +    </table>
  +
  +    <!-- ************ Object Factory tests * START -->
   	<table name="INITIALIZABLE_OBJECT">
   		<column name="ID" primaryKey="true" type="BIGINT"/>
   	</table>
  
  
  
  1.64      +2 -1      db-ojb/src/test/org/apache/ojb/broker/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- AllTests.java	3 Sep 2005 15:28:13 -0000	1.63
  +++ AllTests.java	14 Nov 2005 00:36:11 -0000	1.64
  @@ -66,6 +66,7 @@
           TestSuite suite = new TestSuite();
           suite.addTestSuite(TableAliasHandlerTest.class);
           suite.addTestSuite(QueryTest.class);
  +        suite.addTestSuite(EmptyTableTest.class);
           suite.addTestSuite(PersistenceBrokerTest.class);
           suite.addTestSuite(QuotedTest.class);
           suite.addTestSuite(BrokerExamples.class);
  
  
  
  1.2       +10 -0     db-ojb/src/test/org/apache/ojb/broker/Area.java
  
  Index: Area.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/Area.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Area.java	13 May 2003 15:23:31 -0000	1.1
  +++ Area.java	14 Nov 2005 00:36:11 -0000	1.2
  @@ -7,5 +7,15 @@
   public class Area 
       extends BaseQualifierImpl
   {
  +    private String description;
   
  +    public String getDescription()
  +    {
  +        return description;
  +    }
  +
  +    public void setDescription(String description)
  +    {
  +        this.description = description;
  +    }
   }
  
  
  
  1.12      +63 -2     db-ojb/src/test/org/apache/ojb/broker/ExtentAwarePathExpressionsTest.java
  
  Index: ExtentAwarePathExpressionsTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ExtentAwarePathExpressionsTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ExtentAwarePathExpressionsTest.java	27 Aug 2005 12:39:54 -0000	1.11
  +++ ExtentAwarePathExpressionsTest.java	14 Nov 2005 00:36:11 -0000	1.12
  @@ -181,7 +181,7 @@
   }
   
       // Test for OJB-50
  -    public void testComplexCriteriaWithPathClasses()
  +    public void testComplexCriteriaWithPathClasses_1()
       {
           Criteria criteria         = new Criteria();
           Criteria categoryCriteria = new Criteria();
  @@ -200,4 +200,65 @@
           assertEquals(1, content.size());
           assertEquals(2, ((News)content.get(0)).getId());
       }
  +
  +    // Test for OJB-50
  +    public void testComplexCriteriaWithPathClasses_2()
  +    {
  +        Criteria criteria         = new Criteria();
  +        Criteria categoryCriteria = new Criteria();
  +        Criteria topicCriteria    = new Criteria();
  +
  +        categoryCriteria.addLike("qualifiers.description", "The%");
  +        categoryCriteria.addPathClass("qualifiers", Category.class);
  +        categoryCriteria.addPathClass("qualifiers", TopicExt.class);
  +
  +        topicCriteria.addEqualTo("qualifiers.importance", "important");
  +        topicCriteria.addPathClass("qualifiers", Topic.class);
  +        topicCriteria.addPathClass("qualifiers", TopicExt.class);
  +
  +        criteria.addOrCriteria(categoryCriteria);
  +        criteria.addOrCriteria(topicCriteria);
  +
  +        QueryByCriteria query   = QueryFactory.newQuery(BaseContentImpl.class, criteria, true);
  +        List            content = (List) broker.getCollectionByQuery(query);
  +
  +        assertEquals(1, content.size());
  +        assertEquals(2, ((News)content.get(0)).getId());
  +        assertNotNull(((News)content.get(0)).getQualifiers());
  +        assertEquals(3, ((News)content.get(0)).getQualifiers().size());
   }
  +
  +    // Test for OJB-50
  +    public void testComplexCriteriaWithPathClasses_3()
  +    {
  +        Criteria criteria         = new Criteria();
  +        Criteria criteriaTopicExtAndCategory         = new Criteria();
  +        Criteria categoryCriteria = new Criteria();
  +        Criteria topicCriteria    = new Criteria();
  +        Criteria topicExtCriteria    = new Criteria();
  +
  +        categoryCriteria.addLike("qualifiers.description", "The buyer");
  +        categoryCriteria.addPathClass("qualifiers", Category.class);
  +
  +        topicExtCriteria.addLike("qualifiers.description", "The buyer");
  +        topicExtCriteria.addPathClass("qualifiers", TopicExt.class);
  +
  +        criteriaTopicExtAndCategory.addOrCriteria(categoryCriteria);
  +        criteriaTopicExtAndCategory.addOrCriteria(topicExtCriteria);
  +
  +        topicCriteria.addEqualTo("qualifiers.importance", "important");
  +        topicCriteria.addPathClass("qualifiers", Topic.class);
  +        topicCriteria.addPathClass("qualifiers", TopicExt.class);
  +
  +        criteria.addAndCriteria(criteriaTopicExtAndCategory);
  +        criteria.addAndCriteria(topicCriteria);
  +
  +        QueryByCriteria query   = QueryFactory.newQuery(BaseContentImpl.class, criteria, true);
  +        List            content = (List) broker.getCollectionByQuery(query);
  +
  +        assertEquals(1, content.size());
  +        assertEquals(2, ((News)content.get(0)).getId());
  +        assertNotNull(((News)content.get(0)).getQualifiers());
  +        assertEquals(3, ((News)content.get(0)).getQualifiers().size());
  +    }
  +}
  \ No newline at end of file
  
  
  
  1.20      +424 -127  db-ojb/src/test/org/apache/ojb/broker/M2NTest.java
  
  Index: M2NTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/M2NTest.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- M2NTest.java	1 Oct 2005 13:50:33 -0000	1.19
  +++ M2NTest.java	14 Nov 2005 00:36:11 -0000	1.20
  @@ -1,23 +1,25 @@
   package org.apache.ojb.broker;
   
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.Iterator;
  +import java.util.List;
  +
  +import org.apache.commons.lang.ClassUtils;
  +import org.apache.commons.lang.builder.EqualsBuilder;
  +import org.apache.commons.lang.builder.HashCodeBuilder;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.time.StopWatch;
  -import org.apache.commons.lang.ClassUtils;
   import org.apache.ojb.broker.core.proxy.CollectionProxy;
  -import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
   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.junit.PBTestCase;
   
  -import java.util.ArrayList;
  -import java.util.Collection;
  -import java.util.Iterator;
  -import java.util.List;
  -
   /** 
    * Test (non-decomposed) M:N relations.
    *
  @@ -44,31 +46,111 @@
   
       public void tearDown() throws Exception
       {
  -        if(broker != null)
  -        {
  -            changeActorCollectionDescriptorTo(false, NONE, NONE, false);
  -            changeMovieCollectionDescriptorTo(false, NONE, NONE, false);
  -            changeMovieWithArrayCollectionDescriptorTo(false, NONE, NONE, false);
  -            broker.close();
  -        }
           super.tearDown();
       }
   
  +    /**
  +     * Test for OJB-76
  +     */
  +    public void testStoreWithSharedIndirectionTableColumn()
  +    {
  +        ojbChangeReferenceSetting(MovieImpl.class, "producers", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(Producer.class, "movies", true, OBJECT, OBJECT, false);
  +        String timestamp = "" + System.currentTimeMillis();
  +        String postfix = "testStoreWithSharedIndirectionTableColumn_" + timestamp;
  +
  +        Movie m_1 = new MovieImpl(postfix, postfix + "_1", null);
  +        Movie m_2 = new MovieImpl(postfix, postfix + "_2", null);
  +        Producer p_1 = new Producer(postfix, "producer_" + timestamp);
  +        m_1.addProducer(p_1);
  +        p_1.addMovie(m_1);
  +        broker.beginTransaction();
  +        broker.store(p_1, ObjectModification.INSERT);
  +        broker.commitTransaction();
  +
  +        broker.clearCache();
  +        Criteria crit = new Criteria();
  +        crit.addLike("title", postfix + "%");
  +        Query q = QueryFactory.newQuery(Movie.class, crit);
  +        Movie new_m_1 = (Movie) broker.getObjectByQuery(q);
  +        assertNotNull(new_m_1);
  +        assertNotNull(new_m_1.getProducers());
  +        assertEquals(1, new_m_1.getProducers().size());
  +
  +        broker.beginTransaction();
  +        p_1.addMovie(m_2);
  +        m_2.addProducer(p_1);
  +        broker.store(p_1, ObjectModification.UPDATE);
  +        // or (but this will cause more DB traffic)
  +        // broker.store(m_2, ObjectModification.INSERT);
  +        broker.commitTransaction();
  +
  +        broker.clearCache();
  +        new_m_1 = (Movie) broker.getObjectByQuery(q);
  +        assertNotNull(new_m_1);
  +        assertNotNull(new_m_1.getProducers());
  +        assertEquals(1, new_m_1.getProducers().size());
  +        Producer new_p_1 = (Producer) new_m_1.getProducers().get(0);
  +        assertNotNull(new_p_1);
  +        assertNotNull(new_p_1.getMovies());
  +        assertEquals(2, new_p_1.getMovies().size());
  +
  +
  +        broker.beginTransaction();
  +        broker.delete(p_1);
  +        broker.commitTransaction();
  +
  +        new_m_1 = (Movie) broker.getObjectByQuery(q);
  +        assertNull(new_m_1);
  +
  +        crit = new Criteria();
  +        crit.addEqualTo("name", "producer_" + timestamp);
  +        q = QueryFactory.newQuery(Producer.class, crit);
  +        new_p_1 = (Producer) broker.getObjectByQuery(q);
  +        assertNull(new_p_1);
  +    }
  +
  +    public void testSimpleStore()
  +    {
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, OBJECT, false);
  +        String postfix = "testSimple_" + System.currentTimeMillis();
  +        Movie m = new MovieImpl(postfix, postfix, null);
  +        Actor a = new Actor(postfix);
  +
  +        broker.beginTransaction();
  +        broker.store(m);
  +        broker.store(a);
  +
  +        m.addActor(a);
  +        broker.store(m);
  +        broker.commitTransaction();
  +
  +        broker.retrieveAllReferences(a);
  +
  +        assertNotNull(a.getMovies());
  +        assertEquals(1, a.getMovies().size());
  +    }
  +
  +    /**
  +     * Test deprecated auto Settings
  +     */
       public void testAutoUpdateDeleteSettings()
       {
  -        changeActorCollectionDescriptorTo(false, false, false, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", false, false, false, false);
           CollectionDescriptor ord = broker.getClassDescriptor(Actor.class)
                   .getCollectionDescriptorByName("movies");
  -        assertEquals(CollectionDescriptor.CASCADE_LINK, ord.getCascadingStore());
  -        assertEquals(CollectionDescriptor.CASCADE_LINK, ord.getCascadingDelete());
  +        assertEquals(LINK, ord.getCascadingStore());
  +        assertEquals(LINK, ord.getCascadingDelete());
           assertEquals(false, ord.getCascadeStore());
           assertEquals(false, ord.getCascadeDelete());
   
  -        changeActorCollectionDescriptorTo(false, true, true, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", false, true, true, false);
           ord = broker.getClassDescriptor(Actor.class)
                   .getCollectionDescriptorByName("movies");
  -        assertEquals(CollectionDescriptor.CASCADE_OBJECT, ord.getCascadingStore());
  -        assertEquals(CollectionDescriptor.CASCADE_OBJECT, ord.getCascadingDelete());
  +        assertEquals(OBJECT, ord.getCascadingStore());
  +        assertEquals(OBJECT, ord.getCascadingDelete());
           assertEquals(true, ord.getCascadeStore());
           assertEquals(true, ord.getCascadeDelete());
       }
  @@ -76,8 +158,9 @@
       public void testRetrieveProxiedCollection()
       {
           String postfix = "testRetrieveProxiedCollection_" + System.currentTimeMillis();
  -        changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, true);
  -     
  +        ojbChangeReferenceSetting(Movie.class, "actors", true, OBJECT, OBJECT, true);
  +        ojbChangeReferenceSetting(Movie.class, "actors2", true, OBJECT, OBJECT, true);
  +
           Movie m1 = buildMovieWithActors(postfix + "_1", 10);
           Movie m2 = buildMovieWithActors(postfix + "_2", 20);
   
  @@ -110,7 +193,7 @@
       public void testRetrieveArray()
       {
           String postfix = "testRetrieveArray_" + System.currentTimeMillis();
  -        changeMovieWithArrayCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieWithArrayImpl.class, "actors", true, OBJECT, OBJECT, false);
        
           MovieWithArray m1 = buildMovieWithActorsArray(postfix + "_1", 10);
           MovieWithArray m2 = buildMovieWithActorsArray(postfix + "_2", 20);
  @@ -140,8 +223,9 @@
           long testPeriod = 0;
   
           String postfix = "testMassStoreUpdateAutomatic_" + System.currentTimeMillis();
  -        changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  -        changeActorCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, OBJECT, false);
   
           Movie movie = buildMovieWithActors(postfix, actorCount);
           Actor actor = buildActorWithMovies(postfix, movieCount);
  @@ -202,7 +286,7 @@
           //*****************************
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           movie = (Movie) broker.getObjectByIdentity(oid);
   
           resultMovie = broker.getCollectionByQuery(queryMovie);
  @@ -232,7 +316,7 @@
           //*****************************
   
           broker.clearCache();
  -        oid = new Identity(actor, broker);
  +        oid = broker.serviceIdentity().buildIdentity(actor);
           actor = (Actor) broker.getObjectByIdentity(oid);
   
           resultMovie = broker.getCollectionByQuery(queryMovie);
  @@ -264,8 +348,9 @@
           long testPeriod = 0;
   
           String postfix = "testMassStoreUpdateLinking" + System.currentTimeMillis();
  -        changeMovieCollectionDescriptorTo(true, NONE, OBJECT, false);
  -        changeActorCollectionDescriptorTo(true, NONE, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, NONE, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, NONE, OBJECT, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, NONE, OBJECT, false);
   
           Movie movie = buildMovieWithActors(postfix, actorCount);
           Actor actor = buildActorWithMovies(postfix, movieCount);
  @@ -339,7 +424,7 @@
           //*****************************
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           movie = (Movie) broker.getObjectByIdentity(oid);
   
           resultMovie = broker.getCollectionByQuery(queryMovie);
  @@ -369,7 +454,7 @@
           //*****************************
   
           broker.clearCache();
  -        oid = new Identity(actor, broker);
  +        oid = broker.serviceIdentity().buildIdentity(actor);
           actor = (Actor) broker.getObjectByIdentity(oid);
   
           resultMovie = broker.getCollectionByQuery(queryMovie);
  @@ -402,8 +487,9 @@
       // an object graph
       public void YYYtestStoreAddUpdateDeleteTLLF()
       {
  -        changeMovieCollectionDescriptorTo(true, LINK, LINK, false);
  -        changeActorCollectionDescriptorTo(true, LINK, LINK, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, LINK, LINK, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, LINK, LINK, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, LINK, LINK, false);
           String postfix = "_testStoreTLLF_" + System.currentTimeMillis();
           Movie movie = buildMovieWithActorsAndBackReferences(postfix);
           doTestStoreAddUpdateDeleteTLLX(movie, postfix);
  @@ -411,8 +497,9 @@
   
       public void YYYtestStoreAddUpdateDeleteTLLT()
       {
  -        changeMovieCollectionDescriptorTo(true, LINK, LINK, true);
  -        changeActorCollectionDescriptorTo(true, LINK, LINK, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, LINK, LINK, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, LINK, LINK, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, LINK, LINK, false);
           String postfix = "_testStoreTLLF_" + System.currentTimeMillis();
           Movie movie = buildMovieWithActorsAndBackReferences(postfix);
           doTestStoreAddUpdateDeleteTLLX(movie, postfix);
  @@ -510,8 +597,9 @@
        */
       public void testStoreFFFF()
       {
  -        changeMovieCollectionDescriptorTo(false, NONE, NONE, false);
  -        changeActorCollectionDescriptorTo(false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", false, NONE, NONE, false);
           String postfix = "" + System.currentTimeMillis();
           Movie movie = buildMovieWithActors(postfix);
           doTestStoreFFFX(movie, postfix);
  @@ -523,8 +611,9 @@
        */
       public void testStoreFFFT()
       {
  -        changeMovieCollectionDescriptorTo(false, NONE, NONE, true);
  -        changeActorCollectionDescriptorTo(false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", false, NONE, NONE, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", false, NONE, NONE, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", false, NONE, NONE, false);
           String postfix = "" + System.currentTimeMillis();
           Movie movie = buildMovieWithActors(postfix);
           doTestStoreFFFX(movie, postfix);
  @@ -537,8 +626,9 @@
        */
       public void testStoreFFFF_2()
       {
  -        changeMovieCollectionDescriptorTo(false, NONE, NONE, false);
  -        changeActorCollectionDescriptorTo(false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", false, NONE, NONE, false);
           String postfix = "" + System.currentTimeMillis();
           Movie movie = buildMovieWithActorsAndBackReferences(postfix);
           doTestStoreFFFX(movie, postfix);
  @@ -551,8 +641,9 @@
        */
       public void testStoreFFFT_2()
       {
  -        changeMovieCollectionDescriptorTo(false, NONE, NONE, true);
  -        changeActorCollectionDescriptorTo(false, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", false, NONE, NONE, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", false, NONE, NONE, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", false, NONE, NONE, false);
           String postfix = "" + System.currentTimeMillis();
           Movie movie = buildMovieWithActorsAndBackReferences(postfix);
           doTestStoreFFFX(movie, postfix);
  @@ -615,7 +706,7 @@
           assertEquals(3, resultRole.size());
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           Movie readMovie = (Movie) broker.getObjectByIdentity(oid);
           assertNotNull(readMovie);
           // auto-retrieve false
  @@ -682,8 +773,9 @@
        */
       public void testStoreTFFF()
       {
  -        changeMovieCollectionDescriptorTo(true, NONE, NONE, false);
  -        changeActorCollectionDescriptorTo(true, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, NONE, NONE, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, NONE, NONE, false);
           doTestStoreTFFX();
       }
   
  @@ -693,8 +785,9 @@
        */
       public void testStoreTFFT()
       {
  -        changeMovieCollectionDescriptorTo(true, NONE, NONE, true);
  -        changeActorCollectionDescriptorTo(true, NONE, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, NONE, NONE, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, NONE, NONE, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, NONE, NONE, false);
           doTestStoreTFFX();
       }
   
  @@ -713,8 +806,8 @@
           stored - no other inserts!
           */
           Query queryMovie = queryMovie(postfix);
  -        Collection resultMovie = broker.getCollectionByQuery(queryMovie);
  -        assertEquals(1, resultMovie.size());
  +        Collection collMovie = broker.getCollectionByQuery(queryMovie);
  +        assertEquals(1, collMovie.size());
   
           Query queryActor = queryActor(postfix);
           Collection resultActor = broker.getCollectionByQuery(queryActor);
  @@ -747,8 +840,8 @@
           /*
           now we expect all stored objects
           */
  -        resultMovie = broker.getCollectionByQuery(queryMovie);
  -        assertEquals(1, resultMovie.size());
  +        collMovie = broker.getCollectionByQuery(queryMovie);
  +        assertEquals(1, collMovie.size());
   
           resultActor = broker.getCollectionByQuery(queryActor);
           assertEquals(3, resultActor.size());
  @@ -757,13 +850,39 @@
           assertEquals(3, resultRole.size());
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           Movie readMovie = (Movie) broker.getObjectByIdentity(oid);
           assertNotNull(readMovie);
           // auto-retrieve true
           assertTrue(readMovie.getActors() != null);
           assertEquals(3, readMovie.getActors().size());
   
  +        // Now we want to add new objects
  +        Actor a1 = new Actor(postfix);
  +        Actor a2 = new Actor(postfix);
  +        readMovie.addActor(a1);
  +        readMovie.addActor(a2);
  +        broker.beginTransaction();
  +        broker.store(a1);
  +        broker.store(a2);
  +        broker.serviceBrokerHelper().unlink(readMovie, "actors");
  +        broker.serviceBrokerHelper().link(readMovie, "actors", true);
  +        broker.commitTransaction();
  +
  +        collMovie = broker.getCollectionByQuery(queryMovie);
  +        assertEquals(1, collMovie.size());
  +        resultActor = broker.getCollectionByQuery(queryActor);
  +        assertEquals(5, resultActor.size());
  +        resultRole = broker.getCollectionByQuery(queryRole);
  +        assertEquals(5, resultRole.size());
  +        broker.clearCache();
  +        oid = broker.serviceIdentity().buildIdentity(movie);
  +        readMovie = (Movie) broker.getObjectByIdentity(oid);
  +        assertNotNull(readMovie);
  +        // auto-retrieve true
  +        assertTrue(readMovie.getActors() != null);
  +        assertEquals(5, readMovie.getActors().size());
  +
           // We try to delete all objects
           // first do unlink the m:n references
           broker.beginTransaction();
  @@ -776,30 +895,32 @@
   
           broker.clearCache();
           // TODO: replace this with query below (when prefetching bug was solved)
  -        Movie movieLookup = (Movie) broker.getObjectByIdentity(new Identity(movie, broker));
  -        assertNotNull(movieLookup);
  -        //resultMovie = broker.getCollectionByQuery(queryMovie);
  -        //assertEquals(1, resultMovie.size());
  +        //Movie movieLookup = (Movie) broker.getObjectByIdentity(broker.serviceIdentity().buildIdentity(movie));
  +        //assertNotNull(movieLookup);
  +        collMovie = broker.getCollectionByQuery(queryMovie);
  +        assertEquals(1, collMovie.size());
  +        readMovie = (Movie) collMovie.iterator().next();
  +        assertEquals(0, readMovie.getActors().size());
   
           resultActor = broker.getCollectionByQuery(queryActor);
  -        assertEquals(3, resultActor.size());
  +        assertEquals(5, resultActor.size());
   
           resultRole = broker.getCollectionByQuery(queryRole);
           assertEquals(0, resultRole.size());
   
           // now we delete the n- and m-side objects
           broker.beginTransaction();
  -        Iterator iter = movie.getActors().iterator();
  +        Iterator iter = resultActor.iterator();
           while(iter.hasNext())
           {
               broker.delete(iter.next());
           }
  -        broker.delete(movie);
  +        broker.delete(readMovie);
           broker.commitTransaction();
   
  -        broker.clearCache();
  -        resultMovie = broker.getCollectionByQuery(queryMovie);
  -        assertEquals(0, resultMovie.size());
  +        // broker.clearCache();
  +        collMovie = broker.getCollectionByQuery(queryMovie);
  +        assertEquals(0, collMovie.size());
   
           resultActor = broker.getCollectionByQuery(queryActor);
           assertEquals(0, resultActor.size());
  @@ -817,15 +938,17 @@
   
       public void testStoreTTFF()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, false);
  -        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, NONE, false);
           doTestStoreTTXX();
       }
   
       public void testStoreTTFT()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, true);
  -        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, NONE, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, NONE, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, NONE, false);
           doTestStoreTTXX();
       }
   
  @@ -852,7 +975,7 @@
           assertEquals(3, resultRole.size());
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           Movie readMovie = (Movie) broker.getObjectByIdentity(oid);
           assertNotNull(readMovie);
           assertEquals(3, readMovie.getActors().size());
  @@ -865,8 +988,9 @@
        */
       public void testStoreTTFT_2()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, true);
  -        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, NONE, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, NONE, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, NONE, false);
           doTestStoreTTXX_2();
       }
   
  @@ -893,7 +1017,7 @@
           assertEquals(3, resultRole.size());
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           Movie readMovie = (Movie) broker.getObjectByIdentity(oid);
           assertNotNull(readMovie);
           assertEquals(3, readMovie.getActors().size());
  @@ -901,15 +1025,17 @@
       
       public void testStoreUpdateTTFF()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, false);
  -        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, NONE, false);
           doTestStoreUpdateTTXX();
       }
   
       public void testStoreUpdateTTFF_2()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, true);
  -        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, NONE, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, NONE, true);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, NONE, false);
           doTestStoreUpdateTTXX();
       }
   
  @@ -944,7 +1070,7 @@
           //*****************************
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           movie = (Movie) broker.getObjectByIdentity(oid);
   
           resultMovie = broker.getCollectionByQuery(queryMovie);
  @@ -962,8 +1088,9 @@
   
       public void testStoreUpdateActorTTFF()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, false);
  -        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, NONE, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, NONE, false);
   
           String postfix = "" + System.currentTimeMillis();
           Actor actor = buildActorWithMovies(postfix);
  @@ -986,7 +1113,7 @@
           assertEquals(3, resultRole.size());
   
           broker.clearCache();
  -        Identity oid = new Identity(actor, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(actor);
           Actor loadedActor = (Actor) broker.getObjectByIdentity(oid);
           assertNotNull(loadedActor);
           MovieManageableCollection col = loadedActor.getMovies();
  @@ -996,16 +1123,18 @@
   
       public void testAddNewEntriesTTTF()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  -        changeActorCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, OBJECT, false);
           doTestAddNewEntries();
       }
   
       public void testAddNewEntriesTTTT()
       {
  -        changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT, OBJECT, true);
  +        ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT, OBJECT, true);
           // default proxy does not work for user defined collection
  -        changeActorCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  +        ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT, OBJECT, false);
           doTestAddNewEntries();
       }
   
  @@ -1021,6 +1150,7 @@
           Actor a_1 = new Actor("testAddNewEntries_"+postfix);
           Actor a_2 = new Actor("testAddNewEntries_"+postfix);
           Actor a_3 = new Actor("testAddNewEntries_"+postfix);
  +        Actor a_4 = new Actor("testAddNewEntries_"+postfix);
           /*
           all in all we expect 3 movie, 6 actor, 3 role entries after first
           store.
  @@ -1048,7 +1178,7 @@
           assertEquals(3, resultRole.size());
   
           broker.clearCache();
  -        Identity oid = new Identity(movie, broker);
  +        Identity oid = broker.serviceIdentity().buildIdentity(movie);
           Movie readMovie = (Movie) broker.getObjectByIdentity(oid);
           assertNotNull(readMovie);
           assertEquals(3, readMovie.getActors().size());
  @@ -1061,6 +1191,8 @@
           */
           movie.getActors().add(a_1);
           movie.getActors().add(a_2);
  +        // add new actor object
  +        movie.getActors().add(a_4);
           broker.beginTransaction();
           broker.store(movie);
           broker.commitTransaction();
  @@ -1073,17 +1205,17 @@
   
           queryActor = queryActor(postfix);
           resultActor = broker.getCollectionByQuery(queryActor);
  -        assertEquals(6, resultActor.size());
  +        assertEquals(7, resultActor.size());
   
           queryRole = queryRole(null, movie);
           resultRole = broker.getCollectionByQuery(queryRole);
  -        assertEquals(5, resultRole.size());
  +        assertEquals(6, resultRole.size());
   
           broker.clearCache();
  -        oid = new Identity(movie, broker);
  +        oid = broker.serviceIdentity().buildIdentity(movie);
           readMovie = (Movie) broker.getObjectByIdentity(oid);
           assertNotNull(readMovie);
  -        assertEquals(5, readMovie.getActors().size());
  +        assertEquals(6, readMovie.getActors().size());
   
           /*
           on delete we expect that all entries are deleted except the single
  @@ -1111,27 +1243,24 @@
       {
           Criteria c = new Criteria();
           c.addLike("idStr", "%" + postfix + "%");
  -        QueryByCriteria q = QueryFactory.newQuery(Movie.class, c);
  -        return q;
  +        return QueryFactory.newQuery(Movie.class, c);
       }
   
       QueryByCriteria movieWithArrayQuery(String postfix)
       {
           Criteria c = new Criteria();
           c.addLike("idStr", "%" + postfix + "%");
  -        QueryByCriteria q = QueryFactory.newQuery(MovieWithArray.class, c);
  -        return q;
  +        return QueryFactory.newQuery(MovieWithArray.class, c);
       }
   
       QueryByCriteria queryActor(String postfix)
       {
           Criteria c = new Criteria();
           c.addLike("name", "%" + postfix + "%");
  -        QueryByCriteria q = QueryFactory.newQuery(Actor.class, c);
  -        return q;
  +        return QueryFactory.newQuery(Actor.class, c);
       }
   
  -    Query queryRole(Actor actor, Movie movie)
  +    QueryByCriteria queryRole(Actor actor, Movie movie)
       {
           Criteria c = new Criteria();
           if(actor != null) c.addEqualTo("actorId", actor.getId());
  @@ -1147,8 +1276,7 @@
               c.addEqualTo("movieIntId", movie.getIdInt());
               c.addEqualTo("movieStrId", movie.getIdStr());
           }
  -        QueryByCriteria q = QueryFactory.newQuery(Role.class, c);
  -        return q;
  +        return QueryFactory.newQuery(Role.class, c);
       }
   
       QueryByCriteria roleQueryActorOrMovieMatch(Actor actor, Movie movie)
  @@ -1169,8 +1297,7 @@
           {
               c_2 = c_1;
           }
  -        QueryByCriteria q = QueryFactory.newQuery(Role.class, c_2);
  -        return q;
  +        return QueryFactory.newQuery(Role.class, c_2);
       }
   
       /**
  @@ -1302,31 +1429,7 @@
           return a;
       }
   
  -    void changeActorCollectionDescriptorTo(boolean autoRetrieve, int autoUpdate, int autoDelete, boolean proxy)
  -    {
  -        ojbChangeReferenceSetting(Actor.class, "movies", autoRetrieve, autoUpdate, autoDelete, proxy);
  -    }
   
  -    void changeActorCollectionDescriptorTo(boolean autoRetrieve, boolean autoUpdate, boolean autoDelete, boolean proxy)
  -    {
  -        ClassDescriptor cld = broker.getClassDescriptor(Actor.class);
  -        CollectionDescriptor cod = (CollectionDescriptor) cld.getCollectionDescriptors().get(0);
  -        cod.setLazy(proxy);
  -        cod.setCascadeRetrieve(autoRetrieve);
  -        cod.setCascadeStore(autoUpdate);
  -        cod.setCascadeDelete(autoDelete);
  -    }
  -
  -    void changeMovieCollectionDescriptorTo(boolean autoRetrieve, int autoUpdate, int autoDelete, boolean proxy)
  -    {
  -        ojbChangeReferenceSetting(MovieImpl.class, "actors", autoRetrieve, autoUpdate, autoDelete, proxy);
  -        ojbChangeReferenceSetting(MovieImpl.class, "actors2", autoRetrieve, autoUpdate, autoDelete, proxy);
  -    }
  -
  -    void changeMovieWithArrayCollectionDescriptorTo(boolean autoRetrieve, int autoUpdate, int autoDelete, boolean proxy)
  -    {
  -        ojbChangeReferenceSetting(MovieWithArrayImpl.class, "actors", autoRetrieve, autoUpdate, autoDelete, proxy);
  -    }
   
       //=======================================================================
       // Inner classes, persistence capable  test classes
  @@ -1395,6 +1498,9 @@
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static class Actor
       {
           private Integer id;
  @@ -1421,6 +1527,15 @@
               this.movies = movies;
           }
   
  +        public void addMovie(Movie m)
  +        {
  +            if(movies == null)
  +            {
  +                movies = new MovieManageableCollection();
  +            }
  +            movies.add(m);
  +        }
  +
           public Integer getId()
           {
               return id;
  @@ -1453,18 +1568,26 @@
   
           public String toString()
           {
  -            return ToStringBuilder.reflectionToString(this).toString();
  +            return ToStringBuilder.reflectionToString(this);
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static interface Movie
       {
           public Collection getActors();
           public void setActors(Collection actors);
  +        public void addActor(Actor a);
   
           public Collection getActors2();
           public void setActors2(Collection actors);
   
  +        public List getProducers();
  +        public void setProducers(List producers);
  +        public void addProducer(Producer p);
  +
           public Integer getIdInt2();
           public Integer getIdInt();
   
  @@ -1481,6 +1604,9 @@
           public void setDescription(String description);
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static interface MovieWithArray
       {
           public Actor[] getActors();
  @@ -1506,15 +1632,20 @@
           public void setDescription(String description);
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static class MovieImpl implements Movie
       {
           private Integer idInt;
           private Integer idInt2;
           private String idStr;
  +
           private String title;
           private String description;
           private Collection actors;
           private Collection actors2;
  +        private List producers;
   
           public MovieImpl()
           {
  @@ -1527,6 +1658,29 @@
               this.description = description;
           }
   
  +        public List getProducers()
  +        {
  +            return producers;
  +        }
  +
  +        public void setProducers(List producers)
  +        {
  +            this.producers = producers;
  +        }
  +
  +        public void addProducer(Producer p)
  +        {
  +            if(producers == null)
  +            {
  +                producers = new ArrayList();
  +            }
  +            producers.add(p);
  +            if(p.getMovies() == null || !p.getMovies().contains(this))
  +            {
  +                p.addMovie(this);
  +            }
  +        }
  +
           public Collection getActors()
           {
               return actors;
  @@ -1537,6 +1691,15 @@
               this.actors = actors;
           }
   
  +        public void addActor(Actor a)
  +        {
  +            if(actors == null)
  +            {
  +                actors = new ArrayList();
  +            }
  +            actors.add(a);
  +        }
  +
           public Collection getActors2()
           {
               return actors2;
  @@ -1597,6 +1760,22 @@
               this.description = description;
           }
   
  +        public int hashCode()
  +        {
  +            return new HashCodeBuilder().append(idInt).append(idInt2).append(idStr).hashCode();
  +        }
  +
  +        public boolean equals(Object obj)
  +        {
  +            boolean result = false;
  +            if(obj instanceof MovieImpl)
  +            {
  +                MovieImpl other = (MovieImpl) obj;
  +                result = new EqualsBuilder().append(idInt, other.idInt).append(idInt2, other.idInt2).append(idStr, other.idStr).isEquals();
  +            }
  +            return result;
  +        }
  +
           public String toString()
           {
               return ToStringBuilder.reflectionToString(this).toString();
  @@ -1683,12 +1862,31 @@
               this.description = description;
           }
   
  +        public int hashCode()
  +        {
  +            return new HashCodeBuilder().append(idInt).append(idInt2).append(idStr).hashCode();
  +        }
  +
  +        public boolean equals(Object obj)
  +        {
  +            boolean result = false;
  +            if(obj instanceof MovieImpl)
  +            {
  +                MovieImpl other = (MovieImpl) obj;
  +                result = new EqualsBuilder().append(idInt, other.idInt).append(idInt2, other.idInt2).append(idStr, other.idStr).isEquals();
  +            }
  +            return result;
  +        }
  +
           public String toString()
           {
  -            return ToStringBuilder.reflectionToString(this).toString();
  +            return ToStringBuilder.reflectionToString(this);
           }
       }
       
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static class Role
       {
           private Integer actorId;
  @@ -1753,7 +1951,106 @@
   
           public String toString()
           {
  -            return ToStringBuilder.reflectionToString(this).toString();
  +            return ToStringBuilder.reflectionToString(this);
  +        }
  +    }
  +
  +    //===================================================================
  +    // inner class
  +    //===================================================================
  +    /**
  +     * This class has a m:n relation with Movie and also use a composite
  +     * key.
  +     */
  +    public static class Producer
  +    {
  +        private Integer id;
  +        private String idStr;
  +        private String name;
  +        private List movies;
  +
  +        public Producer()
  +        {
  +        }
  +
  +        public Producer(String idStr, String name)
  +        {
  +            this.idStr = idStr;
  +            this.name = name;
  +        }
  +
  +        public List getMovies()
  +        {
  +            return movies;
  +        }
  +
  +        public void setMovies(List movies)
  +        {
  +            this.movies = movies;
  +        }
  +
  +        public void addMovie(Movie movie)
  +        {
  +            if(movies == null)
  +            {
  +                movies = new ArrayList();
  +            }
  +            movies.add(movie);
  +            if(movie.getProducers() == null || !movie.getProducers().contains(this))
  +            {
  +                movie.addProducer(this);
  +            }
  +        }
  +
  +        public Integer getId()
  +        {
  +            return id;
  +        }
  +
  +        public void setId(Integer id)
  +        {
  +            this.id = id;
  +        }
  +
  +        public String getIdStr()
  +        {
  +            return idStr;
  +        }
  +
  +        public void setIdStr(String idStr)
  +        {
  +            this.idStr = idStr;
  +        }
  +
  +        public String getName()
  +        {
  +            return name;
  +        }
  +
  +        public void setName(String name)
  +        {
  +            this.name = name;
  +        }
  +
  +        public int hashCode()
  +        {
  +            return new HashCodeBuilder().append(id).append(idStr).hashCode();
  +        }
  +
  +        public boolean equals(Object obj)
  +        {
  +            boolean result = false;
  +            if(obj instanceof Producer)
  +            {
  +                Producer other = (Producer) obj;
  +                result = new EqualsBuilder().append(id, other.id).append(idStr, other.idStr).isEquals();
  +            }
  +            return result;
  +        }
  +
  +        public String toString()
  +        {
  +            return ToStringBuilder.reflectionToString(this);
           }
       }
   }
  
  
  
  1.56      +3 -2      db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
  
  Index: PersistenceBrokerTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- PersistenceBrokerTest.java	1 Oct 2005 14:05:33 -0000	1.55
  +++ PersistenceBrokerTest.java	14 Nov 2005 00:36:11 -0000	1.56
  @@ -3,7 +3,6 @@
   import java.sql.Statement;
   import java.util.ArrayList;
   import java.util.Collection;
  -import java.util.Enumeration;
   import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  @@ -302,7 +301,7 @@
           pb_1.close();
           pb_2.close();
           pb_3.close();
  -        ojb.releaseAllConnections();
  +        ojb.releaseAllConfigurations();
           PersistenceBroker pbNew = ojb.lookupBroker();
           if(pbNew instanceof DelegatingPersistenceBroker)
           {
  @@ -1418,6 +1417,8 @@
           {
               InterfaceArticle a1 = (InterfaceArticle) iter1.next();
               InterfaceArticle a2 = (InterfaceArticle) iter2.next();
  +            assertNotNull(a1);
  +            assertNotNull(a2);
               assertEquals("iterators should return equal objects", a1.getArticleId(), a2.getArticleId());
           }
           assertTrue("iter2 should not contain more items than iter1", !iter2.hasNext());
  
  
  
  1.2       +168 -0    db-ojb/src/test/org/apache/ojb/broker/EmptyTableTest.java
  
  
  
  
  1.2       +19 -0     db-ojb/src/test/org/apache/ojb/broker/TopicExt.java
  
  
  
  
  1.9       +6 -7      db-ojb/src/test/org/apache/ojb/odmg/M2NTest.java
  
  Index: M2NTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/M2NTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- M2NTest.java	27 Aug 2005 12:42:41 -0000	1.8
  +++ M2NTest.java	14 Nov 2005 00:36:11 -0000	1.9
  @@ -305,12 +305,11 @@
   // arminw: this test will not work, because we use a user defined ManageableCollection
   // and the collection proxy is not compatible. Maybe this test will work in future versions
   // when it's possible set a CollectionProxy impl in metadate.
  -    public void testStore_2WithProxy() throws Exception
  -    {
  -        changeMovieCollectionDescriptorTo(true, NONE, NONE, true);
  -        changeActorCollectionDescriptorTo(true, NONE, NONE, true);
  -        doTestStore_2();
  -    }
  +//    public void testStore_2WithProxy() throws Exception
  +//    {
  +//        prepareAutoUpdateDeleteSettings(true);
  +//        doTestStore_2();
  +//    }
   
       public void doTestStore_2() throws Exception
       {
  
  
  
  1.141     +28 -1     db-ojb/src/test/org/apache/ojb/repository_junit.xml
  
  Index: repository_junit.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit.xml,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- repository_junit.xml	3 Nov 2005 13:38:23 -0000	1.140
  +++ repository_junit.xml	14 Nov 2005 00:36:11 -0000	1.141
  @@ -3040,11 +3040,19 @@
   	</class-descriptor>
   
   	<class-descriptor class="org.apache.ojb.broker.Topic" table="TOPIC">
  +        <extent-class class-ref="org.apache.ojb.broker.TopicExt"/>
   	   <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
   	   <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR"/>
   	   <field-descriptor name="importance" column="IMPORTANCE" jdbc-type="VARCHAR"/>
   	</class-descriptor>
   
  +    <class-descriptor class="org.apache.ojb.broker.TopicExt" table="TOPIC_EXT">
  +       <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
  +	   <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR"/>
  +	   <field-descriptor name="importance" column="IMPORTANCE" jdbc-type="VARCHAR"/>
  +        <field-descriptor name="description" column="DESCRIPTION" jdbc-type="VARCHAR"/>
  +    </class-descriptor>
  +
   	<class-descriptor class="org.apache.ojb.broker.Category" table="CATEGORY">
   	   <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
   	   <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR"/>
  @@ -3054,6 +3062,7 @@
   	<class-descriptor class="org.apache.ojb.broker.Area" table="AREA">
   	   <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
   	   <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR"/>
  +        <field-descriptor name="description" column="DESCRIPTION" jdbc-type="VARCHAR"/>
   	</class-descriptor>
   
   
  @@ -3351,4 +3360,22 @@
         />
      </class-descriptor>
   
  +
  +    <class-descriptor
  +        class="org.apache.ojb.broker.EmptyTableTest$TestObject"
  +        table="EMPTY_TABLE"
  +    >
  +        <field-descriptor
  +             name="id"
  +             column="ID_"
  +             jdbc-type="INTEGER"
  +             primarykey="true"
  +             autoincrement="true"
  +        />
  +        <field-descriptor
  +             name="name"
  +             column="NAME"
  +             jdbc-type="VARCHAR"
  +        />
  +    </class-descriptor>
   <!-- Mapping of classes used in junit tests and tutorials ends here -->
  \ No newline at end of file
  
  
  
  1.20      +7 -7      db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml
  
  Index: repository_junit_odmg.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- repository_junit_odmg.xml	3 Nov 2005 13:38:24 -0000	1.19
  +++ repository_junit_odmg.xml	14 Nov 2005 00:36:11 -0000	1.20
  @@ -1148,7 +1148,7 @@
   
   <class-descriptor
           class="org.apache.ojb.odmg.M2NTest$MovieImpl"
  -        table="M2N_TEST_MOVIE"
  +        table="M2N_MOVIE"
           >
       <field-descriptor
               name="idInt"
  @@ -1190,7 +1190,7 @@
               name="actors"
               collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
               element-class-ref="org.apache.ojb.odmg.M2NTest$Actor"
  -            indirection-table="M2N_TEST_ROLE"
  +            indirection-table="M2N_ROLE"
               proxy="false"
               auto-retrieve="true"
               auto-update="none"
  @@ -1207,7 +1207,7 @@
               name="actors2"
               collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
               element-class-ref="org.apache.ojb.odmg.M2NTest$Actor"
  -            indirection-table="M2N_TEST_ROLE_2"
  +            indirection-table="M2N_ROLE_2"
               proxy="false"
               auto-retrieve="true"
               auto-update="none"
  @@ -1224,7 +1224,7 @@
   
   <class-descriptor
           class="org.apache.ojb.odmg.M2NTest$Actor"
  -        table="M2N_TEST_ACTOR"
  +        table="M2N_ACTOR"
           >
       <field-descriptor
               name="id"
  @@ -1252,7 +1252,7 @@
               name="movies"
               collection-class="org.apache.ojb.odmg.M2NTest$MovieManageableCollectionImpl"
               element-class-ref="org.apache.ojb.odmg.M2NTest$MovieImpl"
  -            indirection-table="M2N_TEST_ROLE"
  +            indirection-table="M2N_ROLE"
               proxy="false"
               auto-retrieve="false"
               auto-update="none"
  @@ -1268,7 +1268,7 @@
   
   <class-descriptor
           class="org.apache.ojb.odmg.M2NTest$Role"
  -        table="M2N_TEST_ROLE"
  +        table="M2N_ROLE"
           >
       <field-descriptor
               name="actorId"
  
  
  
  1.26      +73 -10    db-ojb/src/test/org/apache/ojb/repository_junit_reference.xml
  
  Index: repository_junit_reference.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit_reference.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- repository_junit_reference.xml	3 Nov 2005 13:38:24 -0000	1.25
  +++ repository_junit_reference.xml	14 Nov 2005 00:36:11 -0000	1.26
  @@ -1455,7 +1455,7 @@
   
       <class-descriptor
      	  class="org.apache.ojb.broker.M2NTest$MovieImpl"
  -   	  table="M2N_TEST_MOVIE"
  +   	  table="M2N_MOVIE"
       >
           <field-descriptor
               name="idInt"
  @@ -1500,11 +1500,11 @@
               auto-retrieve="false"
               auto-update="false"
               auto-delete="false"
  -            indirection-table="M2N_TEST_ROLE"
  +            indirection-table="M2N_ROLE"
           >
               <!-- Check the use of order by element for fields and plain columns -->
               <orderby name="name" sort="ASC"/>
  -            <orderby name="M2N_TEST_ROLE.MOVIE_ID_INT" sort="DESC"/>
  +            <orderby name="M2N_ROLE.MOVIE_ID_INT" sort="DESC"/>
   
               <fk-pointing-to-this-class column="MOVIE_ID_INT"/>
               <fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
  @@ -1519,7 +1519,7 @@
               auto-retrieve="false"
               auto-update="false"
               auto-delete="false"
  -            indirection-table="M2N_TEST_ROLE_2"
  +            indirection-table="M2N_ROLE_2"
           >
               <fk-pointing-to-this-class column="MOVIE_ID_INT"/>
               <fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
  @@ -1528,11 +1528,29 @@
               <fk-pointing-to-element-class column="ACTOR_ID2"/>
           </collection-descriptor>
   
  +        <collection-descriptor
  +            name="producers"
  +            collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
  +            element-class-ref="org.apache.ojb.broker.M2NTest$Producer"
  +            auto-retrieve="false"
  +            auto-update="none"
  +            auto-delete="none"
  +            indirection-table="M2N_MOVIE_PRODUCER"
  +        >
  +            <!-- The ID_STR column is used by both table M2N_MOVIE and M2N_PRODUCER,
  +            because it's a shared PK field in Movie and Producer -->
  +            <fk-pointing-to-this-class column="MOVIE_ID_INT"/>
  +            <fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
  +            <fk-pointing-to-this-class column="ID_STR_SHARED"/>
  +            <fk-pointing-to-element-class column="PRODUCER_ID"/>
  +            <fk-pointing-to-element-class column="ID_STR_SHARED"/>
  +        </collection-descriptor>
  +
       </class-descriptor>
   
       <class-descriptor
      	  class="org.apache.ojb.broker.M2NTest$MovieWithArrayImpl"
  -   	  table="M2N_TEST_MOVIE"
  +   	  table="M2N_MOVIE"
       >
           <field-descriptor
               name="idInt"
  @@ -1576,7 +1594,7 @@
               auto-retrieve="false"
               auto-update="false"
               auto-delete="false"
  -            indirection-table="M2N_TEST_ROLE"
  +            indirection-table="M2N_ROLE"
           >
               <fk-pointing-to-this-class column="MOVIE_ID_INT"/>
               <fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
  @@ -1588,7 +1606,7 @@
   
       <class-descriptor
      	  class="org.apache.ojb.broker.M2NTest$Actor"
  -   	  table="M2N_TEST_ACTOR"
  +   	  table="M2N_ACTOR"
       >
           <field-descriptor
               name="id"
  @@ -1619,7 +1637,7 @@
               auto-retrieve="false"
               auto-update="false"
               auto-delete="false"
  -            indirection-table="M2N_TEST_ROLE"
  +            indirection-table="M2N_ROLE"
           >
               <fk-pointing-to-this-class column="ACTOR_ID"/>
               <fk-pointing-to-this-class column="ACTOR_ID2"/>
  @@ -1631,7 +1649,7 @@
   
       <class-descriptor
      	  class="org.apache.ojb.broker.M2NTest$Role"
  -   	  table="M2N_TEST_ROLE"
  +   	  table="M2N_ROLE"
       >
           <field-descriptor
               name="actorId"
  @@ -1671,6 +1689,51 @@
           />
       </class-descriptor>
   
  +    <class-descriptor
  +   	  class="org.apache.ojb.broker.M2NTest$Producer"
  +   	  table="M2N_PRODUCER"
  +    >
  +        <field-descriptor
  +            name="id"
  +            column="ID_"
  +            jdbc-type="INTEGER"
  +            primarykey="true"
  +            autoincrement="true"
  +        />
  +
  +        <field-descriptor
  +            name="idStr"
  +            column="ID_STR"
  +            jdbc-type="VARCHAR"
  +            primarykey="true"
  +            autoincrement="false"
  +        />
  +
  +        <field-descriptor
  +            name="name"
  +            column="NAME"
  +            jdbc-type="VARCHAR"
  +        />
  +
  +        <collection-descriptor
  +            name="movies"
  +            collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
  +            element-class-ref="org.apache.ojb.broker.M2NTest$Movie"
  +            auto-retrieve="false"
  +            auto-update="none"
  +            auto-delete="none"
  +            indirection-table="M2N_MOVIE_PRODUCER"
  +        >
  +            <!-- The ID_STR column is used by both table M2N_MOVIE and M2N_PRODUCER,
  +            because it's a shared PK field in Movie and Producer -->
  +            <fk-pointing-to-this-class column="PRODUCER_ID"/>
  +            <fk-pointing-to-this-class column="ID_STR_SHARED"/>
  +            <fk-pointing-to-element-class column="MOVIE_ID_INT"/>
  +            <fk-pointing-to-element-class column="MOVIE_ID2_INT"/>
  +            <fk-pointing-to-element-class column="ID_STR_SHARED"/>
  +        </collection-descriptor>
  +    </class-descriptor>
  +
   
   
       <class-descriptor
  
  
  

---------------------------------------------------------------------
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