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 Sun, 13 Nov 2005 15:45:56 GMT
arminw      2005/11/13 07:45:56

  Modified:    src/schema Tag: OJB_1_0_RELEASE ojbtest-data.dtd
                        ojbtest-data.xml ojbtest-schema.xml
               src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        Area.java ExtentAwarePathExpressionsTest.java
                        M2NTest.java
               src/test/org/apache/ojb Tag: OJB_1_0_RELEASE
                        repository_junit.xml repository_junit_odmg.xml
                        repository_junit_reference.xml
  Added:       src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        EmptyTableTest.java TopicExt.java
  Log:
  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
  No                   revision
  No                   revision
  1.14.2.5  +9 -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.14.2.4
  retrieving revision 1.14.2.5
  diff -u -r1.14.2.4 -r1.14.2.5
  --- ojbtest-data.dtd	6 Oct 2005 21:02:22 -0000	1.14.2.4
  +++ ojbtest-data.dtd	13 Nov 2005 15:45:54 -0000	1.14.2.5
  @@ -43,6 +43,7 @@
       News|
       Paper|
       Topic|
  +    TopicExt|
       Category|
       Area|
       ContentQualifier|
  @@ -281,6 +282,14 @@
     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
  
  
  
  1.15.2.7  +5 -0      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.15.2.6
  retrieving revision 1.15.2.7
  diff -u -r1.15.2.6 -r1.15.2.7
  --- ojbtest-data.xml	6 Oct 2005 21:02:22 -0000	1.15.2.6
  +++ ojbtest-data.xml	13 Nov 2005 15:45:54 -0000	1.15.2.7
  @@ -186,6 +186,9 @@
       <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,7 +197,9 @@
   
       <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"/>
   </dataset>
  
  
  
  1.80.2.29 +43 -9     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.80.2.28
  retrieving revision 1.80.2.29
  diff -u -r1.80.2.28 -r1.80.2.29
  --- ojbtest-schema.xml	4 Nov 2005 13:07:27 -0000	1.80.2.28
  +++ ojbtest-schema.xml	13 Nov 2005 15:45:54 -0000	1.80.2.29
  @@ -491,6 +491,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"/>
  @@ -501,6 +509,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 -->
  @@ -905,13 +914,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"/>
  @@ -919,40 +928,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"/>
  @@ -1681,4 +1710,9 @@
       <column name="D_ATTRIB" type="INTEGER" required="false"/>
     </table>
   
  +    <table name="EMPTY_TABLE">
  +        <column name="ID_" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="250"/>
  +    </table>
  +
   </database>
  \ No newline at end of file
  
  
  
  No                   revision
  No                   revision
  1.1.4.1   +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.1.4.1
  diff -u -r1.1 -r1.1.4.1
  --- Area.java	13 May 2003 15:23:31 -0000	1.1
  +++ Area.java	13 Nov 2005 15:45:54 -0000	1.1.4.1
  @@ -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.7.2.3   +65 -3     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.7.2.2
  retrieving revision 1.7.2.3
  diff -u -r1.7.2.2 -r1.7.2.3
  --- ExtentAwarePathExpressionsTest.java	22 Aug 2005 15:34:11 -0000	1.7.2.2
  +++ ExtentAwarePathExpressionsTest.java	13 Nov 2005 15:45:54 -0000	1.7.2.3
  @@ -5,6 +5,7 @@
   
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.query.QueryFactory;
   import org.apache.ojb.junit.PBTestCase;
   
   /**
  @@ -180,7 +181,7 @@
       }
   
       // Test for OJB-50
  -    public void testComplexCriteriaWithPathClasses()
  +    public void testComplexCriteriaWithPathClasses_1()
       {
           Criteria criteria         = new Criteria();
           Criteria categoryCriteria = new Criteria();
  @@ -193,10 +194,71 @@
           categoryCriteria.addPathClass("qualifiers", Category.class);
           criteria.addOrCriteria(categoryCriteria);
   
  -        QueryByCriteria query   = new QueryByCriteria(BaseContentImpl.class, criteria, true);
  +        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());
       }
  +
  +    // 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());
  +    }
   }
  
  
  
  1.7.2.9   +225 -4    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.7.2.8
  retrieving revision 1.7.2.9
  diff -u -r1.7.2.8 -r1.7.2.9
  --- M2NTest.java	3 Nov 2005 12:16:31 -0000	1.7.2.8
  +++ M2NTest.java	13 Nov 2005 15:45:54 -0000	1.7.2.9
  @@ -7,6 +7,8 @@
   
   import org.apache.commons.lang.ClassUtils;
   import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.commons.lang.builder.HashCodeBuilder;
  +import org.apache.commons.lang.builder.EqualsBuilder;
   import org.apache.commons.lang.time.StopWatch;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
  @@ -14,6 +16,7 @@
   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.util.ObjectModification;
   import org.apache.ojb.junit.PBTestCase;
   
   /**
  @@ -51,6 +54,67 @@
           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()
       {
           changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  @@ -1285,6 +1349,7 @@
       }
   
   
  +
       //=======================================================================
       // Inner classes, persistence capable  test classes
       //=======================================================================
  @@ -1356,6 +1421,9 @@
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static class Actor
       {
           private Integer id;
  @@ -1423,10 +1491,13 @@
   
           public String toString()
           {
  -            return ToStringBuilder.reflectionToString(this).toString();
  +            return ToStringBuilder.reflectionToString(this);
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static interface Movie
       {
           public Collection getActors();
  @@ -1436,6 +1507,10 @@
           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();
   
  @@ -1452,15 +1527,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()
           {
  @@ -1473,6 +1553,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;
  @@ -1552,12 +1655,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;
  @@ -1622,7 +1744,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);
           }
       }
   }
  
  
  
  No                   revision
  
  Index: M2NTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/M2NTest.java,v
  retrieving revision 1.7.2.8
  retrieving revision 1.7.2.9
  diff -u -r1.7.2.8 -r1.7.2.9
  --- M2NTest.java	3 Nov 2005 12:16:31 -0000	1.7.2.8
  +++ M2NTest.java	13 Nov 2005 15:45:54 -0000	1.7.2.9
  @@ -7,6 +7,8 @@
   
   import org.apache.commons.lang.ClassUtils;
   import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.commons.lang.builder.HashCodeBuilder;
  +import org.apache.commons.lang.builder.EqualsBuilder;
   import org.apache.commons.lang.time.StopWatch;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
  @@ -14,6 +16,7 @@
   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.util.ObjectModification;
   import org.apache.ojb.junit.PBTestCase;
   
   /**
  @@ -51,6 +54,67 @@
           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()
       {
           changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  @@ -1285,6 +1349,7 @@
       }
   
   
  +
       //=======================================================================
       // Inner classes, persistence capable  test classes
       //=======================================================================
  @@ -1356,6 +1421,9 @@
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static class Actor
       {
           private Integer id;
  @@ -1423,10 +1491,13 @@
   
           public String toString()
           {
  -            return ToStringBuilder.reflectionToString(this).toString();
  +            return ToStringBuilder.reflectionToString(this);
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static interface Movie
       {
           public Collection getActors();
  @@ -1436,6 +1507,10 @@
           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();
   
  @@ -1452,15 +1527,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()
           {
  @@ -1473,6 +1553,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;
  @@ -1552,12 +1655,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;
  @@ -1622,7 +1744,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);
           }
       }
   }
  
  
  
  No                   revision
  
  Index: M2NTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/M2NTest.java,v
  retrieving revision 1.7.2.8
  retrieving revision 1.7.2.9
  diff -u -r1.7.2.8 -r1.7.2.9
  --- M2NTest.java	3 Nov 2005 12:16:31 -0000	1.7.2.8
  +++ M2NTest.java	13 Nov 2005 15:45:54 -0000	1.7.2.9
  @@ -7,6 +7,8 @@
   
   import org.apache.commons.lang.ClassUtils;
   import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.commons.lang.builder.HashCodeBuilder;
  +import org.apache.commons.lang.builder.EqualsBuilder;
   import org.apache.commons.lang.time.StopWatch;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
  @@ -14,6 +16,7 @@
   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.util.ObjectModification;
   import org.apache.ojb.junit.PBTestCase;
   
   /**
  @@ -51,6 +54,67 @@
           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()
       {
           changeMovieCollectionDescriptorTo(true, OBJECT, OBJECT, false);
  @@ -1285,6 +1349,7 @@
       }
   
   
  +
       //=======================================================================
       // Inner classes, persistence capable  test classes
       //=======================================================================
  @@ -1356,6 +1421,9 @@
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static class Actor
       {
           private Integer id;
  @@ -1423,10 +1491,13 @@
   
           public String toString()
           {
  -            return ToStringBuilder.reflectionToString(this).toString();
  +            return ToStringBuilder.reflectionToString(this);
           }
       }
   
  +    //===================================================================
  +    // inner class
  +    //===================================================================
       public static interface Movie
       {
           public Collection getActors();
  @@ -1436,6 +1507,10 @@
           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();
   
  @@ -1452,15 +1527,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()
           {
  @@ -1473,6 +1553,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;
  @@ -1552,12 +1655,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;
  @@ -1622,7 +1744,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.1.2.1   +168 -0    db-ojb/src/test/org/apache/ojb/broker/Attic/EmptyTableTest.java
  
  
  
  
  1.1.2.1   +19 -0     db-ojb/src/test/org/apache/ojb/broker/Attic/TopicExt.java
  
  
  
  
  No                   revision
  No                   revision
  1.112.2.17 +33 -6     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.112.2.16
  retrieving revision 1.112.2.17
  diff -u -r1.112.2.16 -r1.112.2.17
  --- repository_junit.xml	22 Aug 2005 15:32:46 -0000	1.112.2.16
  +++ repository_junit.xml	13 Nov 2005 15:45:55 -0000	1.112.2.17
  @@ -2746,21 +2746,30 @@
   	</class-descriptor>
   
   	<class-descriptor class="org.apache.ojb.broker.Topic" table="TOPIC">
  -	   <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
  +        <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.Category" table="CATEGORY">
  -	   <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
  +    <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"/>
   	   <field-descriptor name="description" column="DESCRIPTION" jdbc-type="VARCHAR"/>
   	</class-descriptor>
   
  -	<class-descriptor class="org.apache.ojb.broker.Area" table="AREA">
  +    <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"/>
  -	</class-descriptor>
  +        <field-descriptor name="description" column="DESCRIPTION" jdbc-type="VARCHAR"/>
  +    </class-descriptor>
   
       <!-- ************************************************* -->
       <!--      nested fields test                           -->
  @@ -2897,4 +2906,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.13.2.17 +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.13.2.16
  retrieving revision 1.13.2.17
  diff -u -r1.13.2.16 -r1.13.2.17
  --- repository_junit_odmg.xml	3 Nov 2005 13:13:31 -0000	1.13.2.16
  +++ repository_junit_odmg.xml	13 Nov 2005 15:45:55 -0000	1.13.2.17
  @@ -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.17.2.7  +71 -8     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.17.2.6
  retrieving revision 1.17.2.7
  diff -u -r1.17.2.6 -r1.17.2.7
  --- repository_junit_reference.xml	3 Nov 2005 13:13:31 -0000	1.17.2.6
  +++ repository_junit_reference.xml	13 Nov 2005 15:45:55 -0000	1.17.2.7
  @@ -1451,7 +1451,7 @@
   
       <class-descriptor
      	  class="org.apache.ojb.broker.M2NTest$MovieImpl"
  -   	  table="M2N_TEST_MOVIE"
  +   	  table="M2N_MOVIE"
       >
           <field-descriptor
               name="idInt"
  @@ -1496,11 +1496,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"/>
  @@ -1515,7 +1515,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"/>
  @@ -1524,11 +1524,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$Actor"
  -   	  table="M2N_TEST_ACTOR"
  +   	  table="M2N_ACTOR"
       >
           <field-descriptor
               name="id"
  @@ -1559,7 +1577,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"/>
  @@ -1571,7 +1589,7 @@
   
       <class-descriptor
      	  class="org.apache.ojb.broker.M2NTest$Role"
  -   	  table="M2N_TEST_ROLE"
  +   	  table="M2N_ROLE"
       >
           <field-descriptor
               name="actorId"
  @@ -1611,6 +1629,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