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
Date Sat, 03 Jul 2004 23:32:16 GMT
arminw      2004/07/03 16:32:16

  Modified:    src/schema ojbtest-schema.xml
               src/test/org/apache/ojb/broker
                        InheritanceMultipleTableTest.java
               src/test/org/apache/ojb/odmg
                        InheritanceMultipleTableTest.java
               src/test/org/apache/ojb repository_junit.xml
                        repository_junit_odmg.xml
  Log:
  update tests to reproduce OJB275
  
  Revision  Changes    Path
  1.81      +12 -4     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
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- ojbtest-schema.xml	23 Jun 2004 18:24:17 -0000	1.80
  +++ ojbtest-schema.xml	3 Jul 2004 23:32:16 -0000	1.81
  @@ -1038,10 +1038,10 @@
       <!-- PB 'readonly' attribute test                        -->
       <!-- =================================================== -->
       <table name="READONLY_TEST">
  -        <column name="OBJ_ID" required="true" primaryKey="true" type="DECIMAL"/>
  +        <column name="OBJ_ID" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
           <column name="NAME" type="VARCHAR" size="150"/>
           <column name="RO_STRING" type="VARCHAR" size="150"/>
  -        <column name="RO_LONG" type="DECIMAL"/>
  +        <column name="RO_LONG" type="DECIMAL" size="15,0"/>
       </table>
   
       <!-- =================================================== -->
  @@ -1128,7 +1128,7 @@
       <!-- PB nested fields test                               -->
       <!-- =================================================== -->
       <table name="NESTED_FIELDS_TAB">
  -     <column name="OBJ_ID" required="true" primaryKey="true" type="DECIMAL"/>
  +     <column name="OBJ_ID" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
        <column name="NAME" type="VARCHAR" size="150"/>
        <column name="NESTED_VALUE" type="VARCHAR" size="150"/>
        <column name="NESTED_DESCRIPTION" type="VARCHAR" size="150"/>
  @@ -1136,7 +1136,7 @@
   
       <table name="NESTED_FIELDS_ENTRY">
        <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  -     <column name="FK_ID" required="true" type="DECIMAL"/>
  +     <column name="FK_ID" required="true" type="DECIMAL" size="15,0"/>
        <column name="NAME" type="VARCHAR" size="150"/>
      </table>
   
  @@ -1163,6 +1163,7 @@
       <!-- =================================================== -->
       <table name="INHERITANCE_MULTI_EMPLOYEE">
           <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
           <column name="NAME" type="VARCHAR" size="150"/>
           <column name="FK_ADDRESS" type="INTEGER"/>
           <foreign-key foreignTable="INHERITANCE_MULTI_ADDRESS">
  @@ -1172,19 +1173,26 @@
   
       <table name="INHERITANCE_MULTI_EXECUTIVE">
           <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
           <column name="SUPER_ID" type="INTEGER"/>
  +        <column name="SUPER_ID_2" type="DECIMAL" size="15,0"/>
           <column name="MANAGER_ID" type="INTEGER"/>
  +        <column name="MANAGER_ID_2" type="DECIMAL" size="15,0"/>
           <column name="DEPARTMENT" type="VARCHAR" size="150"/>
           <foreign-key foreignTable="INHERITANCE_MULTI_EMPLOYEE">
       	  <reference local="SUPER_ID" foreign="OBJ_ID"/>
  +    	  <reference local="SUPER_ID_2" foreign="OBJ_ID_2"/>
   	    </foreign-key>
       </table>
   
       <table name="INHERITANCE_MULTI_MANAGER">
           <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="OBJ_ID_2" required="true" primaryKey="true" type="DECIMAL" size="15,0"/>
           <column name="SUPER_ID" type="INTEGER"/>
  +        <column name="SUPER_ID_2" type="DECIMAL" size="15,0"/>
           <foreign-key foreignTable="INHERITANCE_MULTI_EXECUTIVE">
       	  <reference local="SUPER_ID" foreign="OBJ_ID"/>
  +    	  <reference local="SUPER_ID_2" foreign="OBJ_ID_2"/>
   	    </foreign-key>
       </table>
   
  
  
  
  1.8       +183 -69   db-ojb/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java
  
  Index: InheritanceMultipleTableTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/InheritanceMultipleTableTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- InheritanceMultipleTableTest.java	11 May 2004 11:55:57 -0000	1.7
  +++ InheritanceMultipleTableTest.java	3 Jul 2004 23:32:16 -0000	1.8
  @@ -1,20 +1,25 @@
   package org.apache.ojb.broker;
   
  +import java.io.Serializable;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
   
  +import org.apache.commons.lang.SerializationUtils;
   import org.apache.commons.lang.builder.EqualsBuilder;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
  +import org.apache.ojb.broker.metadata.ClassDescriptor;
   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.junit.PBTestCase;
   
   /**
  - * Test inheritance using multiple tables.
  + * This test check inheritance using multiple tables. The test objects use
  + * a composite PK. One autoincrement PK field - Integer. One non-autoincrement PK field
  + * with manually set PK- Long.
    *
    * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
    * @version $Id$
  @@ -23,29 +28,47 @@
   {
       public static void main(String[] args)
       {
  -        junit.textui.TestRunner.main(new String[] {InheritanceMultipleTableTest.class.getName()});
  +        junit.textui.TestRunner.main(new String[]{InheritanceMultipleTableTest.class.getName()});
       }
   
  -    public void testQuery()
  +    public void testObjectExistence()
       {
  -        String name = "testInsert" + System.currentTimeMillis();
  -        Manager m_1 = new Manager(name + "_manager_1");
  -        Manager m_2 = new Manager(name + "_manager_2");
  -        Manager m_3 = new Manager(name + "_manager_3");
  +        Manager target_1 = new Manager(new Long(1), "testObjectExistence");
  +        Manager target_2 = new Manager(new Long(System.currentTimeMillis()), "testObjectExistence");
  +
  +        Identity oid_1 = new Identity(target_1, broker);
  +        Identity oid_2 = new Identity(target_2, broker);
  +
  +        ClassDescriptor cld = broker.getClassDescriptor(Manager.class);
  +
  +        boolean b_1 = broker.serviceBrokerHelper().doesExist(cld, oid_1, target_1);
  +        boolean b_2 = broker.serviceBrokerHelper().doesExist(cld, oid_2, target_2);
  +        assertFalse(b_1);
  +        assertFalse(b_2);
  +    }
  +
  +    public void testStoreUpdateQuerySerialized()
  +    {
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testInsert" + timestamp;
  +        Manager m_1 = new Manager(id_2, name + "_manager_1");
  +        Manager m_2 = new Manager(id_2, name + "_manager_2");
  +        Manager m_3 = new Manager(id_2, name + "_manager_3");
           m_3.setDepartment("none");
   
  -        Executive ex_1 = new Executive(name+"_executive", "department_1", null);
  -        Executive ex_2 = new Executive(name+"_executive", "department_1", null);
  +        Executive ex_1 = new Executive(id_2, name + "_executive", "department_1", null);
  +        Executive ex_2 = new Executive(id_2, name + "_executive", "department_1", null);
   
  -        Employee em = new Employee(name+"_employee");
  +        Employee em = new Employee(id_2, name + "_employee");
   
           broker.beginTransaction();
  +        broker.store(em);
           broker.store(m_1);
  -        broker.store(m_2);
           broker.store(m_3);
           broker.store(ex_1);
  +        broker.store(m_2);
           broker.store(ex_2);
  -        broker.store(em);
           broker.commitTransaction();
   
           broker.clearCache();
  @@ -57,37 +80,91 @@
           assertEquals(1, result.size());
   
           crit = new Criteria();
  -        crit.addLike("name", name+"%");
  +        crit.addLike("name", name + "%");
           query = QueryFactory.newQuery(Employee.class, crit);
           result = broker.getCollectionByQuery(query);
           assertEquals(6, result.size());
   
           crit = new Criteria();
  -        crit.addLike("name", name+"%");
  +        crit.addLike("name", name + "%");
           query = QueryFactory.newQuery(Executive.class, crit);
           result = broker.getCollectionByQuery(query);
           assertEquals(5, result.size());
   
           crit = new Criteria();
  -        crit.addLike("name", name+"%");
  +        crit.addLike("name", name + "%");
           query = QueryFactory.newQuery(Manager.class, crit);
           result = broker.getCollectionByQuery(query);
           assertEquals(3, result.size());
  +
  +        em = (Employee) SerializationUtils.deserialize(SerializationUtils.serialize(em));
  +        m_1 = (Manager) SerializationUtils.deserialize(SerializationUtils.serialize(m_1));
  +        m_2 = (Manager) SerializationUtils.deserialize(SerializationUtils.serialize(m_2));
  +        m_3 = (Manager) SerializationUtils.deserialize(SerializationUtils.serialize(m_3));
  +        ex_1 = (Executive) SerializationUtils.deserialize(SerializationUtils.serialize(ex_1));
  +        ex_2 = (Executive) SerializationUtils.deserialize(SerializationUtils.serialize(ex_2));
  +
  +        em.setName(em.getName() + "_updated");
  +        m_1.setName(m_1.getName() + "_updated");
  +        m_2.setName(m_2.getName() + "_updated");
  +        m_3.setName(m_3.getName() + "_updated");
  +        ex_1.setName(ex_1.getName() + "_updated");
  +        ex_2.setName(ex_2.getName() + "_updated");
  +
  +        broker.clearCache();
  +        broker.beginTransaction();
  +        broker.store(em);
  +        broker.store(m_1);
  +        broker.store(m_3);
  +        broker.store(ex_1);
  +        broker.store(m_2);
  +        broker.store(ex_2);
  +        broker.commitTransaction();
  +
  +        /*
  +        after de/serialization and update we expect the same row count in
  +        each table
  +        */
  +        broker.clearCache();
  +        crit = new Criteria();
  +        crit.addLike("name", name + "%");
  +        crit.addLike("department", "none");
  +        query = QueryFactory.newQuery(Manager.class, crit);
  +        result = broker.getCollectionByQuery(query);
  +        assertEquals("Expect the same number of objects as before update", 1, result.size());
  +
  +        crit = new Criteria();
  +        crit.addLike("name", name + "%");
  +        query = QueryFactory.newQuery(Employee.class, crit);
  +        result = broker.getCollectionByQuery(query);
  +        assertEquals("Expect the same number of objects as before update", 6, result.size());
  +
  +        crit = new Criteria();
  +        crit.addLike("name", name + "%");
  +        query = QueryFactory.newQuery(Executive.class, crit);
  +        result = broker.getCollectionByQuery(query);
  +        assertEquals("Expect the same number of objects as before update", 5, result.size());
  +
  +        crit = new Criteria();
  +        crit.addLike("name", name + "%");
  +        query = QueryFactory.newQuery(Manager.class, crit);
  +        result = broker.getCollectionByQuery(query);
  +        assertEquals("Expect the same number of objects as before update", 3, result.size());
       }
   
  -    private void prepareForQueryTests(String name)
  +    private void prepareForQueryTests(Long id_2, String name)
       {
  -        Manager m_1 = new Manager(name + "_manager_1");
  -        Manager m_2 = new Manager(name + "_manager_2");
  -        Manager m_3 = new Manager(name + "_manager_3");
  +        Manager m_1 = new Manager(id_2, name + "_manager_1");
  +        Manager m_2 = new Manager(id_2, name + "_manager_2");
  +        Manager m_3 = new Manager(id_2, name + "_manager_3");
           m_3.setDepartment("none");
           Address a_1 = new Address("snob allee");
           m_1.setAddress(a_1);
   
  -        Executive ex_1 = new Executive(name+"_executive", "department_1", null);
  -        Executive ex_2 = new Executive(name+"_executive", "department_1", null);
  +        Executive ex_1 = new Executive(id_2, name + "_executive", "department_1", null);
  +        Executive ex_2 = new Executive(id_2, name + "_executive", "department_1", null);
   
  -        Employee em = new Employee(name+"_employee");
  +        Employee em = new Employee(id_2, name + "_employee");
           Address a_2 = new Address("cockroaches valley");
           em.setAddress(a_2);
   
  @@ -103,16 +180,18 @@
   
       public void testQuery_InheritedObjects()
       {
  -        String name = "testQuery_InheritedObjects" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedObjects" + timestamp;
  +        prepareForQueryTests(id_2, name);
           broker.clearCache();
   
           Criteria crit = new Criteria();
  -        crit.addLike("name", name+"%");
  +        crit.addLike("name", name + "%");
           Query query = QueryFactory.newQuery(Employee.class, crit);
           Collection result = broker.getCollectionByQuery(query);
           assertEquals(6, result.size());
  -        for(Iterator iterator = result.iterator(); iterator.hasNext();)
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
           {
               Employee obj = (Employee) iterator.next();
               assertNotNull(obj.getName());
  @@ -120,11 +199,11 @@
   
           broker.clearCache();
           crit = new Criteria();
  -        crit.addLike("name", name+"%");
  +        crit.addLike("name", name + "%");
           query = QueryFactory.newQuery(Executive.class, crit);
           result = broker.getCollectionByQuery(query);
           assertEquals(5, result.size());
  -        for(Iterator iterator = result.iterator(); iterator.hasNext();)
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
           {
               Executive obj = (Executive) iterator.next();
               assertNotNull(obj.getName());
  @@ -132,11 +211,11 @@
   
           broker.clearCache();
           crit = new Criteria();
  -        crit.addLike("name", name+"%");
  +        crit.addLike("name", name + "%");
           query = QueryFactory.newQuery(Manager.class, crit);
           result = broker.getCollectionByQuery(query);
           assertEquals(3, result.size());
  -        for(Iterator iterator = result.iterator(); iterator.hasNext();)
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
           {
               Manager obj = (Manager) iterator.next();
               assertNotNull(obj.getName());
  @@ -145,8 +224,10 @@
   
       public void testQuery_InheritedField()
       {
  -        String name = "testQuery_InheritedField" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedField" + timestamp;
  +        prepareForQueryTests(id_2, name);
           broker.clearCache();
   
           broker.clearCache();
  @@ -160,8 +241,10 @@
   
       public void testQuery_Reference()
       {
  -        String name = "testQuery_Reference" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_Reference" + timestamp;
  +        prepareForQueryTests(id_2, name);
           broker.clearCache();
   
           Criteria crit = new Criteria();
  @@ -177,8 +260,10 @@
   
       public void testQuery_InheritedReference_1()
       {
  -        String name = "testQuery_InheritedReference_1" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedReference_1" + timestamp;
  +        prepareForQueryTests(id_2, name);
           broker.clearCache();
   
           Criteria crit = new Criteria();
  @@ -196,8 +281,10 @@
   
       public void testQuery_InheritedReference_2()
       {
  -        String name = "testQuery_InheritedReference_2" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedReference_2" + timestamp;
  +        prepareForQueryTests(id_2, name);
           broker.clearCache();
   
           Criteria crit = new Criteria();
  @@ -210,12 +297,14 @@
           Executive retManager = (Executive) result.iterator().next();
           assertNotNull(retManager);
           assertEquals(name + "_manager_1", retManager.getName());
  -   }
  +    }
   
       public void testQuery_InheritedReference_3()
       {
  -        String name = "testQuery_InheritedReference_3" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedReference_3" + timestamp;
  +        prepareForQueryTests(id_2, name);
           broker.clearCache();
   
           Criteria crit = new Criteria();
  @@ -228,14 +317,16 @@
   
       public void testInsertQuery()
       {
  -        String name = "testInsert" + System.currentTimeMillis();
  -        Employee em1 = new Employee(name);
  -        Executive ex1 = new Executive(name, "department_1", null);
  -        Executive ex2 = new Executive(name, "department_2", null);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testInsert" + timestamp;
  +        Employee em1 = new Employee(id_2, name);
  +        Executive ex1 = new Executive(id_2, name, "department_1", null);
  +        Executive ex2 = new Executive(id_2, name, "department_2", null);
           ArrayList list = new ArrayList();
           list.add(ex1);
           list.add(ex2);
  -        Manager m1 = new Manager(name);
  +        Manager m1 = new Manager(id_2, name);
           m1.setExecutives(list);
   
           broker.beginTransaction();
  @@ -279,14 +370,16 @@
   
       public void testUpdate()
       {
  -        String name = "testUpdate" + System.currentTimeMillis();
  -        Employee em1 = new Employee("employee_" + name);
  -        Executive ex1 = new Executive("executive_" + name, "department_1", null);
  -        Executive ex2 = new Executive("executive_" + name, "department_2", null);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testUpdate" + timestamp;
  +        Employee em1 = new Employee(id_2, "employee_" + name);
  +        Executive ex1 = new Executive(id_2, "executive_" + name, "department_1", null);
  +        Executive ex2 = new Executive(id_2, "executive_" + name, "department_2", null);
           ArrayList list = new ArrayList();
           list.add(ex1);
           list.add(ex2);
  -        Manager m1 = new Manager("manager_" + name);
  +        Manager m1 = new Manager(id_2, "manager_" + name);
           m1.setExecutives(list);
   
           broker.beginTransaction();
  @@ -306,9 +399,9 @@
   
           assertEquals(2, newM1.getExecutives().size());
   
  -        newEm1.setName("**updated_"+name);
  -        newM1.setName("**updated_"+name);
  -        ((Executive) newM1.getExecutives().get(0)).setName("**updated_"+name);
  +        newEm1.setName("**updated_" + name);
  +        newM1.setName("**updated_" + name);
  +        ((Executive) newM1.getExecutives().get(0)).setName("**updated_" + name);
   
           broker.beginTransaction();
           broker.store(newEm1);
  @@ -331,14 +424,16 @@
   
       public void testDelete()
       {
  -        String name = "testUpdate" + System.currentTimeMillis();
  -        Employee em1 = new Employee("employee_" + name);
  -        Executive ex1 = new Executive("executive_" + name, "department_1", null);
  -        Executive ex2 = new Executive("executive_" + name, "department_2", null);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testUpdate" + timestamp;
  +        Employee em1 = new Employee(id_2, "employee_" + name);
  +        Executive ex1 = new Executive(id_2, "executive_" + name, "department_1", null);
  +        Executive ex2 = new Executive(id_2, "executive_" + name, "department_2", null);
           ArrayList list = new ArrayList();
           list.add(ex1);
           list.add(ex2);
  -        Manager m1 = new Manager("manager_" + name);
  +        Manager m1 = new Manager(id_2, "manager_" + name);
           m1.setExecutives(list);
   
           broker.beginTransaction();
  @@ -387,9 +482,9 @@
           {
           }
   
  -        public Manager(String name)
  +        public Manager(Long id_2, String name)
           {
  -            super(name,null, null);
  +            super(id_2, name, null, null);
           }
   
           public List getExecutives()
  @@ -412,9 +507,9 @@
           {
           }
   
  -        public Executive(String name, String department, Manager manager)
  +        public Executive(Long id_2, String name, String department, Manager manager)
           {
  -            super(name);
  +            super(id_2, name);
               this.department = department;
               this.manager = manager;
           }
  @@ -441,7 +536,7 @@
   
           public boolean equals(Object obj)
           {
  -            if(! (obj instanceof Executive))
  +            if (!(obj instanceof Executive))
               {
                   return false;
               }
  @@ -452,9 +547,10 @@
           }
       }
   
  -    public static class Employee
  +    public static class Employee implements Serializable
       {
           private Integer id;
  +        private Long id_2;
           private String name;
           private AddressIF address;
   
  @@ -462,8 +558,9 @@
           {
           }
   
  -        public Employee(String name)
  +        public Employee(Long id_2, String name)
           {
  +            this.id_2 = id_2;
               this.name = name;
           }
   
  @@ -472,6 +569,16 @@
               return id;
           }
   
  +        public Long getId_2()
  +        {
  +            return id_2;
  +        }
  +
  +        public void setId_2(Long id_2)
  +        {
  +            this.id_2 = id_2;
  +        }
  +
           public void setId(Integer id)
           {
               this.id = id;
  @@ -499,12 +606,16 @@
   
           public boolean equals(Object obj)
           {
  -            if(! (obj instanceof Employee))
  +            if (!(obj instanceof Employee))
               {
                   return false;
               }
               Employee em = (Employee) obj;
  -            return new EqualsBuilder().append(getId(), em.getId()).append(getName(), em.getName()).isEquals();
  +            return new EqualsBuilder()
  +                    .append(getId(), em.getId())
  +                    .append(getId_2(), em.getId_2())
  +                    .append(getName(), em.getName())
  +                    .isEquals();
           }
   
           public String toString()
  @@ -551,8 +662,11 @@
       public static interface AddressIF
       {
           public Integer getId();
  +
           public void setId(Integer id);
  +
           public String getStreet();
  +
           public void setStreet(String street);
       }
   }
  
  
  
  1.2       +223 -76   db-ojb/src/test/org/apache/ojb/odmg/InheritanceMultipleTableTest.java
  
  Index: InheritanceMultipleTableTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/InheritanceMultipleTableTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InheritanceMultipleTableTest.java	11 May 2004 11:55:57 -0000	1.1
  +++ InheritanceMultipleTableTest.java	3 Jul 2004 23:32:16 -0000	1.2
  @@ -1,10 +1,12 @@
   package org.apache.ojb.odmg;
   
  +import java.io.Serializable;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
   
  +import org.apache.commons.lang.SerializationUtils;
   import org.apache.commons.lang.builder.EqualsBuilder;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
  @@ -23,21 +25,23 @@
   {
       public static void main(String[] args)
       {
  -        junit.textui.TestRunner.main(new String[] {InheritanceMultipleTableTest.class.getName()});
  +        junit.textui.TestRunner.main(new String[]{InheritanceMultipleTableTest.class.getName()});
       }
   
       public void testQuery() throws Exception
       {
  -        String name = "testInsert" + System.currentTimeMillis();
  -        Manager m_1 = new Manager(name + "_manager_1");
  -        Manager m_2 = new Manager(name + "_manager_2");
  -        Manager m_3 = new Manager(name + "_manager_3");
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testInsert" + timestamp;
  +        Manager m_1 = new Manager(id_2, name + "_manager_1");
  +        Manager m_2 = new Manager(id_2, name + "_manager_2");
  +        Manager m_3 = new Manager(id_2, name + "_manager_3");
           m_3.setDepartment("none");
   
  -        Executive ex_1 = new Executive(name+"_executive", "department_1", null);
  -        Executive ex_2 = new Executive(name+"_executive", "department_1", null);
  +        Executive ex_1 = new Executive(id_2, name + "_executive", "department_1", null);
  +        Executive ex_2 = new Executive(id_2, name + "_executive", "department_1", null);
   
  -        Employee em = new Employee(name+"_employee");
  +        Employee em = new Employee(id_2, name + "_employee");
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
  @@ -54,44 +58,150 @@
           tx.commit();
   
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Manager.class.getName()+" where name like $1 and department like $2");
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1 and department like $2");
           query.bind(name + "%");
           query.bind("none");
           Collection result = (Collection) query.execute();
           assertEquals(1, result.size());
   
           query = odmg.newOQLQuery();
  -        query.create("select objects from " + Employee.class.getName()+" where name like $1");
  +        query.create("select objects from " + Employee.class.getName() + " where name like $1");
           query.bind(name + "%");
           result = (Collection) query.execute();
           assertEquals(6, result.size());
   
           query = odmg.newOQLQuery();
  -        query.create("select objects from " + Executive.class.getName()+" where name like $1");
  +        query.create("select objects from " + Executive.class.getName() + " where name like $1");
           query.bind(name + "%");
           result = (Collection) query.execute();
           assertEquals(5, result.size());
   
           query = odmg.newOQLQuery();
  -        query.create("select objects from " + Manager.class.getName()+" where name like $1");
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1");
           query.bind(name + "%");
           result = (Collection) query.execute();
           assertEquals(3, result.size());
       }
   
  -    private void prepareForQueryTests(String name)
  +    public void testQueryWithSerializedObjects() throws Exception
       {
  -        Manager m_1 = new Manager(name + "_manager_1");
  -        Manager m_2 = new Manager(name + "_manager_2");
  -        Manager m_3 = new Manager(name + "_manager_3");
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testInsert" + timestamp;
  +        Manager m_1 = new Manager(id_2, name + "_manager_1");
  +        Manager m_2 = new Manager(id_2, name + "_manager_2");
  +        Manager m_3 = new Manager(id_2, name + "_manager_3");
  +        m_3.setDepartment("none");
  +
  +        Executive ex_1 = new Executive(id_2, name + "_executive", "department_1", null);
  +        Executive ex_2 = new Executive(id_2, name + "_executive", "department_1", null);
  +
  +        Employee em = new Employee(id_2, name + "_employee");
  +
  +        TransactionExt tx = (TransactionExt) odmg.newTransaction();
  +        tx.begin();
  +        database.makePersistent(m_1);
  +        database.makePersistent(m_2);
  +        database.makePersistent(m_3);
  +        database.makePersistent(ex_1);
  +        database.makePersistent(ex_2);
  +        database.makePersistent(em);
  +        tx.commit();
  +
  +        tx.begin();
  +        tx.getBroker().clearCache();
  +        tx.commit();
  +
  +        OQLQuery query = odmg.newOQLQuery();
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1 and department like $2");
  +        query.bind(name + "%");
  +        query.bind("none");
  +        Collection result = (Collection) query.execute();
  +        assertEquals(1, result.size());
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Employee.class.getName() + " where name like $1");
  +        query.bind(name + "%");
  +        result = (Collection) query.execute();
  +        assertEquals(6, result.size());
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Executive.class.getName() + " where name like $1");
  +        query.bind(name + "%");
  +        result = (Collection) query.execute();
  +        assertEquals(5, result.size());
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1");
  +        query.bind(name + "%");
  +        result = (Collection) query.execute();
  +        assertEquals(3, result.size());
  +
  +        em = (Employee) SerializationUtils.deserialize(SerializationUtils.serialize(em));
  +        m_1 = (Manager) SerializationUtils.deserialize(SerializationUtils.serialize(m_1));
  +        m_2 = (Manager) SerializationUtils.deserialize(SerializationUtils.serialize(m_2));
  +        m_3 = (Manager) SerializationUtils.deserialize(SerializationUtils.serialize(m_3));
  +        ex_1 = (Executive) SerializationUtils.deserialize(SerializationUtils.serialize(ex_1));
  +        ex_2 = (Executive) SerializationUtils.deserialize(SerializationUtils.serialize(ex_2));
  +
  +        tx = (TransactionExt) odmg.newTransaction();
  +        tx.begin();
  +        tx.getBroker().clearCache();
  +        tx.lock(em, Transaction.WRITE);
  +        tx.lock(m_1, Transaction.WRITE);
  +        tx.lock(m_2, Transaction.WRITE);
  +        tx.lock(m_3, Transaction.WRITE);
  +        tx.lock(ex_1, Transaction.WRITE);
  +        tx.lock(ex_2, Transaction.WRITE);
  +
  +        em.setName(em.getName() + "_updated");
  +        m_1.setName(m_1.getName() + "_updated");
  +        m_2.setName(m_2.getName() + "_updated");
  +        m_3.setName(m_3.getName() + "_updated");
  +        ex_1.setName(ex_1.getName() + "_updated");
  +        ex_2.setName(ex_2.getName() + "_updated");
  +
  +        tx.commit();
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1 and department like $2");
  +        query.bind(name + "%");
  +        query.bind("none");
  +        result = (Collection) query.execute();
  +        assertEquals("Expect the same number of objects as before update", 1, result.size());
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Employee.class.getName() + " where name like $1");
  +        query.bind(name + "%");
  +        result = (Collection) query.execute();
  +        assertEquals("Expect the same number of objects as before update", 6, result.size());
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Executive.class.getName() + " where name like $1");
  +        query.bind(name + "%");
  +        result = (Collection) query.execute();
  +        assertEquals("Expect the same number of objects as before update", 5, result.size());
  +
  +        query = odmg.newOQLQuery();
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1");
  +        query.bind(name + "%");
  +        result = (Collection) query.execute();
  +        assertEquals("Expect the same number of objects as before update", 3, result.size());
  +    }
  +
  +    private void prepareForQueryTests(Long id_2, String name)
  +    {
  +        Manager m_1 = new Manager(id_2, name + "_manager_1");
  +        Manager m_2 = new Manager(id_2, name + "_manager_2");
  +        Manager m_3 = new Manager(id_2, name + "_manager_3");
           m_3.setDepartment("none");
           Address a_1 = new Address("snob allee");
           m_1.setAddress(a_1);
   
  -        Executive ex_1 = new Executive(name+"_executive", "department_1", null);
  -        Executive ex_2 = new Executive(name+"_executive", "department_1", null);
  +        Executive ex_1 = new Executive(id_2, name + "_executive", "department_1", null);
  +        Executive ex_2 = new Executive(id_2, name + "_executive", "department_1", null);
   
  -        Employee em = new Employee(name+"_employee");
  +        Employee em = new Employee(id_2, name + "_employee");
           Address a_2 = new Address("cockroaches valley");
           em.setAddress(a_2);
   
  @@ -108,19 +218,21 @@
   
       public void testQuery_InheritedObjects() throws Exception
       {
  -        String name = "testQuery_InheritedObjects" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedObjects" + timestamp;
  +        prepareForQueryTests(id_2, name);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.getBroker().clearCache();
   
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Employee.class.getName()+" where name like $1");
  +        query.create("select objects from " + Employee.class.getName() + " where name like $1");
           query.bind(name + "%");
           Collection result = (Collection) query.execute();
           assertEquals(6, result.size());
  -        for(Iterator iterator = result.iterator(); iterator.hasNext();)
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
           {
               Employee obj = (Employee) iterator.next();
               assertNotNull(obj.getName());
  @@ -128,11 +240,11 @@
   
           tx.getBroker().clearCache();
           query = odmg.newOQLQuery();
  -        query.create("select objects from " + Executive.class.getName()+" where name like $1");
  +        query.create("select objects from " + Executive.class.getName() + " where name like $1");
           query.bind(name + "%");
           result = (Collection) query.execute();
           assertEquals(5, result.size());
  -        for(Iterator iterator = result.iterator(); iterator.hasNext();)
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
           {
               Executive obj = (Executive) iterator.next();
               assertNotNull(obj.getName());
  @@ -140,11 +252,11 @@
   
           tx.getBroker().clearCache();
           query = odmg.newOQLQuery();
  -        query.create("select objects from " + Manager.class.getName()+" where name like $1");
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1");
           query.bind(name + "%");
           result = (Collection) query.execute();
           assertEquals(3, result.size());
  -        for(Iterator iterator = result.iterator(); iterator.hasNext();)
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
           {
               Manager obj = (Manager) iterator.next();
               assertNotNull(obj.getName());
  @@ -155,13 +267,15 @@
   
       public void testQuery_InheritedField() throws Exception
       {
  -        String name = "testQuery_InheritedField" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedField" + timestamp;
  +        prepareForQueryTests(id_2, name);
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.getBroker().clearCache();
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Manager.class.getName()+" where name like $1 and department like $2");
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1 and department like $2");
           query.bind(name + "%");
           query.bind("none");
           Collection result = (Collection) query.execute();
  @@ -171,14 +285,16 @@
   
       public void testQuery_Reference() throws Exception
       {
  -        String name = "testQuery_Reference" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_Reference" + timestamp;
  +        prepareForQueryTests(id_2, name);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.getBroker().clearCache();
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Employee.class.getName()+" where name like $1 and address.street like $2");
  +        query.create("select objects from " + Employee.class.getName() + " where name like $1 and address.street like $2");
           query.bind(name + "%");
           query.bind("%valley");
           Collection result = (Collection) query.execute();
  @@ -192,14 +308,16 @@
   
       public void testQuery_InheritedReference_1() throws Exception
       {
  -        String name = "testQuery_InheritedReference_1" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedReference_1" + timestamp;
  +        prepareForQueryTests(id_2, name);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.getBroker().clearCache();
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Manager.class.getName()+" where name like $1 and address.street like $2");
  +        query.create("select objects from " + Manager.class.getName() + " where name like $1 and address.street like $2");
           query.bind(name + "%");
           query.bind("snob allee");
           Collection result = (Collection) query.execute();
  @@ -215,14 +333,16 @@
   
       public void testQuery_InheritedReference_2() throws Exception
       {
  -        String name = "testQuery_InheritedReference_2" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedReference_2" + timestamp;
  +        prepareForQueryTests(id_2, name);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.getBroker().clearCache();
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Executive.class.getName()+" where name like $1 and address.street like $2");
  +        query.create("select objects from " + Executive.class.getName() + " where name like $1 and address.street like $2");
           query.bind(name + "%");
           query.bind("snob allee");
           Collection result = (Collection) query.execute();
  @@ -232,18 +352,20 @@
           Executive retManager = (Executive) result.iterator().next();
           assertNotNull(retManager);
           assertEquals(name + "_manager_1", retManager.getName());
  -   }
  +    }
   
       public void testQuery_InheritedReference_3() throws Exception
       {
  -        String name = "testQuery_InheritedReference_3" + System.currentTimeMillis();
  -        prepareForQueryTests(name);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testQuery_InheritedReference_3" + timestamp;
  +        prepareForQueryTests(id_2, name);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           tx.getBroker().clearCache();
           OQLQuery query = odmg.newOQLQuery();
  -        query.create("select objects from " + Employee.class.getName()+" where name like $1 and address.street like $2");
  +        query.create("select objects from " + Employee.class.getName() + " where name like $1 and address.street like $2");
           query.bind(name + "%");
           query.bind("snob allee");
           Collection result = (Collection) query.execute();
  @@ -256,14 +378,16 @@
   
       public void testInsertQuery() throws Exception
       {
  -        String name = "testInsert" + System.currentTimeMillis();
  -        Employee em1 = new Employee(name);
  -        Executive ex1 = new Executive(name, "department_1", null);
  -        Executive ex2 = new Executive(name, "department_2", null);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testInsert" + timestamp;
  +        Employee em1 = new Employee(id_2, name);
  +        Executive ex1 = new Executive(id_2, name, "department_1", null);
  +        Executive ex2 = new Executive(id_2, name, "department_2", null);
           ArrayList list = new ArrayList();
           list.add(ex1);
           list.add(ex2);
  -        Manager m1 = new Manager(name);
  +        Manager m1 = new Manager(id_2, name);
           m1.setExecutives(list);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
  @@ -292,15 +416,15 @@
           assertEquals(2, newM1.getExecutives().size());
   
           OQLQuery queryEmployee = odmg.newOQLQuery();
  -        queryEmployee.create("select objects from " + Employee.class.getName()+" where name like $1");
  +        queryEmployee.create("select objects from " + Employee.class.getName() + " where name like $1");
           queryEmployee.bind(name);
   
           OQLQuery queryExecutive = odmg.newOQLQuery();
  -        queryExecutive.create("select objects from " + Executive.class.getName()+" where name like $1");
  +        queryExecutive.create("select objects from " + Executive.class.getName() + " where name like $1");
           queryExecutive.bind(name);
   
           OQLQuery queryManager = odmg.newOQLQuery();
  -        queryManager.create("select objects from " + Manager.class.getName()+" where name like $1");
  +        queryManager.create("select objects from " + Manager.class.getName() + " where name like $1");
           queryManager.bind(name);
   
           Collection result = (Collection) queryEmployee.execute();
  @@ -316,16 +440,18 @@
       public void testUpdate() throws Exception
       {
           // TODO: not all changes are written to DB
  -        if(ojbSkipKnownIssueProblem()) return;
  +        if (ojbSkipKnownIssueProblem()) return;
   
  -        String name = "testUpdate" + System.currentTimeMillis();
  -        Employee em1 = new Employee("employee_" + name);
  -        Executive ex1 = new Executive("executive_" + name, "department_1", null);
  -        Executive ex2 = new Executive("executive_" + name, "department_2", null);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testUpdate" + timestamp;
  +        Employee em1 = new Employee(id_2, "employee_" + name);
  +        Executive ex1 = new Executive(id_2, "executive_" + name, "department_1", null);
  +        Executive ex2 = new Executive(id_2, "executive_" + name, "department_2", null);
           ArrayList list = new ArrayList();
           list.add(ex1);
           list.add(ex2);
  -        Manager m1 = new Manager("manager_" + name);
  +        Manager m1 = new Manager(id_2, "manager_" + name);
           m1.setExecutives(list);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
  @@ -352,9 +478,9 @@
           tx.lock(newEm1, Transaction.WRITE);
           tx.lock(newEx1, Transaction.WRITE);
           tx.lock(newM1, Transaction.WRITE);
  -        newEm1.setName("**updated_"+name);
  -        newM1.setName("**updated_"+name);
  -        ((Executive) newM1.getExecutives().get(0)).setName("**updated_"+name);
  +        newEm1.setName("**updated_" + name);
  +        newM1.setName("**updated_" + name);
  +        ((Executive) newM1.getExecutives().get(0)).setName("**updated_" + name);
           tx.commit();
   
           //*************************************
  @@ -375,16 +501,18 @@
       public void testDelete()
       {
           // TODO: not all objects will be deleted
  -        if(ojbSkipKnownIssueProblem()) return;
  +        if (ojbSkipKnownIssueProblem()) return;
   
  -        String name = "testUpdate" + System.currentTimeMillis();
  -        Employee em1 = new Employee("employee_" + name);
  -        Executive ex1 = new Executive("executive_" + name, "department_1", null);
  -        Executive ex2 = new Executive("executive_" + name, "department_2", null);
  +        long timestamp = System.currentTimeMillis();
  +        Long id_2 = new Long(timestamp);
  +        String name = "testUpdate" + timestamp;
  +        Employee em1 = new Employee(id_2, "employee_" + name);
  +        Executive ex1 = new Executive(id_2, "executive_" + name, "department_1", null);
  +        Executive ex2 = new Executive(id_2, "executive_" + name, "department_2", null);
           ArrayList list = new ArrayList();
           list.add(ex1);
           list.add(ex2);
  -        Manager m1 = new Manager("manager_" + name);
  +        Manager m1 = new Manager(id_2, "manager_" + name);
           m1.setExecutives(list);
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
  @@ -440,9 +568,9 @@
           {
           }
   
  -        public Manager(String name)
  +        public Manager(Long id_2, String name)
           {
  -            super(name,null, null);
  +            super(id_2, name, null, null);
           }
   
           public List getExecutives()
  @@ -465,9 +593,9 @@
           {
           }
   
  -        public Executive(String name, String department, Manager manager)
  +        public Executive(Long id_2, String name, String department, Manager manager)
           {
  -            super(name);
  +            super(id_2, name);
               this.department = department;
               this.manager = manager;
           }
  @@ -494,7 +622,7 @@
   
           public boolean equals(Object obj)
           {
  -            if(! (obj instanceof Executive))
  +            if (!(obj instanceof Executive))
               {
                   return false;
               }
  @@ -505,9 +633,10 @@
           }
       }
   
  -    public static class Employee
  +    public static class Employee implements Serializable
       {
           private Integer id;
  +        private Long id_2;
           private String name;
           private AddressIF address;
   
  @@ -515,8 +644,9 @@
           {
           }
   
  -        public Employee(String name)
  +        public Employee(Long id_2, String name)
           {
  +            this.id_2 = id_2;
               this.name = name;
           }
   
  @@ -525,6 +655,16 @@
               return id;
           }
   
  +        public Long getId_2()
  +        {
  +            return id_2;
  +        }
  +
  +        public void setId_2(Long id_2)
  +        {
  +            this.id_2 = id_2;
  +        }
  +
           public void setId(Integer id)
           {
               this.id = id;
  @@ -552,12 +692,16 @@
   
           public boolean equals(Object obj)
           {
  -            if(! (obj instanceof Employee))
  +            if (!(obj instanceof Employee))
               {
                   return false;
               }
               Employee em = (Employee) obj;
  -            return new EqualsBuilder().append(getId(), em.getId()).append(getName(), em.getName()).isEquals();
  +            return new EqualsBuilder()
  +                    .append(getId(), em.getId())
  +                    .append(getId_2(), em.getId_2())
  +                    .append(getName(), em.getName())
  +                    .isEquals();
           }
   
           public String toString()
  @@ -604,8 +748,11 @@
       public static interface AddressIF
       {
           public Integer getId();
  +
           public void setId(Integer id);
  +
           public String getStreet();
  +
           public void setStreet(String street);
       }
   }
  
  
  
  1.114     +44 -2     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.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- repository_junit.xml	3 Jul 2004 18:22:14 -0000	1.113
  +++ repository_junit.xml	3 Jul 2004 23:32:16 -0000	1.114
  @@ -1891,6 +1891,13 @@
           autoincrement="true"
       />
       <field-descriptor
  +        name="id_2"
  +        column="OBJ_ID_2"
  +        jdbc-type="BIGINT"
  +        primarykey="true"
  +        autoincrement="false"
  +    />
  +    <field-descriptor
           name="name"
           column="NAME"
           jdbc-type="VARCHAR"
  @@ -1925,6 +1932,13 @@
           autoincrement="true"
       />
       <field-descriptor
  +        name="id_2"
  +        column="OBJ_ID_2"
  +        jdbc-type="BIGINT"
  +        primarykey="true"
  +        autoincrement="false"
  +    />
  +    <field-descriptor
           name="department"
           column="DEPARTMENT"
           jdbc-type="VARCHAR"
  @@ -1935,6 +1949,12 @@
           jdbc-type="INTEGER"
           access="anonymous"
       />
  +    <field-descriptor
  +        name="superId_2"
  +        column="SUPER_ID_2"
  +        jdbc-type="BIGINT"
  +        access="anonymous"
  +    />
   
       <field-descriptor
           name="managerId"
  @@ -1942,6 +1962,12 @@
           jdbc-type="INTEGER"
           access="anonymous"
       />
  +    <field-descriptor
  +        name="managerId_2"
  +        column="MANAGER_ID_2"
  +        jdbc-type="BIGINT"
  +        access="anonymous"
  +    />
   
       <reference-descriptor name="super"
           class-ref="org.apache.ojb.broker.InheritanceMultipleTableTest$Employee"
  @@ -1950,6 +1976,7 @@
           auto-delete="object"
       >
           <foreignkey field-ref="superId" />
  +        <foreignkey field-ref="superId_2" />
       </reference-descriptor>
   
       <reference-descriptor name="manager"
  @@ -1959,6 +1986,7 @@
           auto-delete="none"
       >
           <foreignkey field-ref="managerId" />
  +        <foreignkey field-ref="managerId_2" />
       </reference-descriptor>
   </class-descriptor>
   
  @@ -1973,13 +2001,25 @@
           primarykey="true"
           autoincrement="true"
       />
  -
  +    <field-descriptor
  +        name="id_2"
  +        column="OBJ_ID_2"
  +        jdbc-type="BIGINT"
  +        primarykey="true"
  +        autoincrement="false"
  +    />
       <field-descriptor
           name="superId"
           column="SUPER_ID"
           jdbc-type="INTEGER"
           access="anonymous"
       />
  +    <field-descriptor
  +        name="superId_2"
  +        column="SUPER_ID_2"
  +        jdbc-type="BIGINT"
  +        access="anonymous"
  +    />
   
       <reference-descriptor name="super"
           class-ref="org.apache.ojb.broker.InheritanceMultipleTableTest$Executive"
  @@ -1988,6 +2028,7 @@
           auto-delete="object"
       >
           <foreignkey field-ref="superId" />
  +        <foreignkey field-ref="superId_2" />
       </reference-descriptor>
   
       <collection-descriptor
  @@ -1999,6 +2040,7 @@
           auto-delete="object"
       >
               <inverse-foreignkey field-ref="managerId"/>
  +            <inverse-foreignkey field-ref="managerId_2"/>
       </collection-descriptor>
   </class-descriptor>
   
  
  
  
  1.14      +46 -3     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
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- repository_junit_odmg.xml	23 Jun 2004 00:04:47 -0000	1.13
  +++ repository_junit_odmg.xml	3 Jul 2004 23:32:16 -0000	1.14
  @@ -1242,6 +1242,13 @@
           autoincrement="true"
       />
       <field-descriptor
  +        name="id_2"
  +        column="OBJ_ID_2"
  +        jdbc-type="BIGINT"
  +        primarykey="true"
  +        autoincrement="false"
  +    />
  +    <field-descriptor
           name="name"
           column="NAME"
           jdbc-type="VARCHAR"
  @@ -1276,6 +1283,13 @@
           autoincrement="true"
       />
       <field-descriptor
  +        name="id_2"
  +        column="OBJ_ID_2"
  +        jdbc-type="BIGINT"
  +        primarykey="true"
  +        autoincrement="false"
  +    />
  +    <field-descriptor
           name="department"
           column="DEPARTMENT"
           jdbc-type="VARCHAR"
  @@ -1286,6 +1300,12 @@
           jdbc-type="INTEGER"
           access="anonymous"
       />
  +    <field-descriptor
  +        name="superId_2"
  +        column="SUPER_ID_2"
  +        jdbc-type="BIGINT"
  +        access="anonymous"
  +    />
   
       <field-descriptor
           name="managerId"
  @@ -1293,6 +1313,12 @@
           jdbc-type="INTEGER"
           access="anonymous"
       />
  +    <field-descriptor
  +        name="managerId_2"
  +        column="MANAGER_ID_2"
  +        jdbc-type="BIGINT"
  +        access="anonymous"
  +    />
   
       <reference-descriptor name="super"
           class-ref="org.apache.ojb.odmg.InheritanceMultipleTableTest$Employee"
  @@ -1301,15 +1327,17 @@
           auto-delete="false"
       >
           <foreignkey field-ref="superId" />
  +        <foreignkey field-ref="superId_2" />
       </reference-descriptor>
   
       <reference-descriptor name="manager"
           class-ref="org.apache.ojb.odmg.InheritanceMultipleTableTest$Manager"
           auto-retrieve="false"
  -        auto-update="none"
  -        auto-delete="none"
  +        auto-update="false"
  +        auto-delete="false"
       >
           <foreignkey field-ref="managerId" />
  +        <foreignkey field-ref="managerId_2" />
       </reference-descriptor>
   </class-descriptor>
   
  @@ -1324,6 +1352,13 @@
           primarykey="true"
           autoincrement="true"
       />
  +    <field-descriptor
  +        name="id_2"
  +        column="OBJ_ID_2"
  +        jdbc-type="BIGINT"
  +        primarykey="true"
  +        autoincrement="false"
  +    />
   
       <field-descriptor
           name="superId"
  @@ -1331,6 +1366,12 @@
           jdbc-type="INTEGER"
           access="anonymous"
       />
  +    <field-descriptor
  +        name="superId_2"
  +        column="SUPER_ID_2"
  +        jdbc-type="BIGINT"
  +        access="anonymous"
  +    />
   
       <reference-descriptor name="super"
           class-ref="org.apache.ojb.odmg.InheritanceMultipleTableTest$Executive"
  @@ -1339,6 +1380,7 @@
           auto-delete="false"
       >
           <foreignkey field-ref="superId" />
  +        <foreignkey field-ref="superId_2" />
       </reference-descriptor>
   
       <collection-descriptor
  @@ -1350,6 +1392,7 @@
           auto-delete="false"
       >
               <inverse-foreignkey field-ref="managerId"/>
  +            <inverse-foreignkey field-ref="managerId_2"/>
       </collection-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