db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util BrokerHelper.java
Date Sun, 15 Aug 2004 12:42:29 GMT
brj         2004/08/15 05:42:29

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerImpl.java
               src/test/org/apache/ojb/dirty DirtyBrokerTest.java
               .        .project release-notes.txt
               src/java/org/apache/ojb/broker/accesslayer
                        RowReaderDefaultImpl.java
               src/test/org/apache/ojb repository_junit.xml repository.dtd
                        spy.properties
               src/java/org/apache/ojb/broker/metadata RepositoryTags.java
                        RepositoryElements.java ClassDescriptor.java
                        RepositoryXmlHandler.java DescriptorRepository.java
               src/java/org/apache/ojb/dirty
                        ObjectRegistrationListener.java
               src/test/org/apache/ojb/broker PersistenceBrokerTest.java
               src/java/org/apache/ojb/broker/util BrokerHelper.java
  Added:       src/java/org/apache/ojb/broker/metadata
                        DiscriminatorFieldDescriptor.java
  Log:
  replaced 'ojbConcreteClass' with discriminator-descriptor
  
  Revision  Changes    Path
  1.89      +2 -4      db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- PersistenceBrokerImpl.java	11 Aug 2004 00:41:45 -0000	1.88
  +++ PersistenceBrokerImpl.java	15 Aug 2004 12:42:27 -0000	1.89
  @@ -22,7 +22,6 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Set;
  -import java.util.ArrayList;
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.IdentityFactory;
  @@ -1831,7 +1830,7 @@
           while (extents.hasNext())
           {
               BrokerHelper.CldInfo cldInfo = (BrokerHelper.CldInfo) extents.next();
  -            Query theQuery = serviceBrokerHelper().setConcreteClassCriteria((QueryByCriteria)query,
cldInfo.concreteClasses);
  +            Query theQuery = serviceBrokerHelper().setConcreteClassCriteria((QueryByCriteria)query,
cldInfo);
               
               if(logger.isDebugEnabled()) logger.debug("Adding RsIterator of class ["+ cldInfo.cld.getClassNameOfObject()+"]
to ChainingIterator");
   
  @@ -1842,7 +1841,6 @@
           return chainingIter;
       }
   
  -    
       /**
        * Get an extent aware Iterator based on the ReportQuery
        *
  
  
  
  1.3       +39 -0     db-ojb/src/test/org/apache/ojb/dirty/DirtyBrokerTest.java
  
  Index: DirtyBrokerTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/dirty/DirtyBrokerTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DirtyBrokerTest.java	11 Aug 2004 19:18:03 -0000	1.2
  +++ DirtyBrokerTest.java	15 Aug 2004 12:42:27 -0000	1.3
  @@ -141,6 +141,10 @@
           Address address = new Address("USA", "Wilmington", "Wombat Court");
           // should be disabled to have valid test -- broker.store(address);
           person.addOtherAddress("Store", address);
  +        
  +        Address mainAddress = new Address("USA", "Wilmington-Main", "Wombat Court");
  +        person.setMainAddress(mainAddress);
  +
           broker.commitTransaction();
   
           broker.clearCache();
  @@ -154,4 +158,39 @@
           assertEquals(address.getCity(), desc.getAddress().getCity());
   
       }
  +    
  +    public void testStatementReordering1()
  +    {
  +        broker.beginTransaction();
  +        Person person = new Person();
  +        person.setFirstname("Brian");
  +
  +        Address mainAddress = new Address("USA", "Wilmington-Main", "Wombat Court");
  +        person.setMainAddress(mainAddress);
  +
  +        broker.store(person);
  +        broker.commitTransaction();
  +
  +        broker.clearCache();
  +
  +        broker.beginTransaction();
  +        person = (Person) broker.getObjectByIdentity(broker.serviceIdentity().buildIdentity(person));
  +
  +        Address address = new Address("USA", "Wilmington", "Wombat Court");
  +        // should be disabled to have valid test -- broker.store(address);
  +        person.addOtherAddress("Store", address);
  +        broker.commitTransaction();
  +
  +        broker.clearCache();
  +
  +        person = (Person) broker.getObjectByIdentity(broker.serviceIdentity().buildIdentity(person));
  +        Collection others = person.getOtherAddresses();
  +        assertNotNull(others);
  +        assertEquals(1, others.size());
  +        AddressDesc desc = (AddressDesc) others.iterator().next();
  +        assertNotNull(desc);
  +        assertEquals(address.getCity(), desc.getAddress().getCity());
  +
  +    }
  +
   }
  
  
  
  1.6       +0 -16     db-ojb/.project
  
  Index: .project
  ===================================================================
  RCS file: /home/cvs/db-ojb/.project,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- .project	5 Apr 2004 13:58:58 -0000	1.5
  +++ .project	15 Aug 2004 12:42:27 -0000	1.6
  @@ -1,20 +1,4 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<!--
  -#/* Copyright 2004 Apache Software Foundation
  -# *
  -# * Licensed under the Apache License, Version 2.0 (the "License");
  -# * you may not use this file except in compliance with the License.
  -# * You may obtain a copy of the License at
  -# *
  -# *     http://www.apache.org/licenses/LICENSE-2.0
  -# *
  -# * Unless required by applicable law or agreed to in writing, software
  -# * distributed under the License is distributed on an "AS IS" BASIS,
  -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  -# * See the License for the specific language governing permissions and
  -# * limitations under the License.
  -# */
  --->
   <projectDescription>
   	<name>db-ojb</name>
   	<comment></comment>
  
  
  
  1.59      +24 -1     db-ojb/release-notes.txt
  
  Index: release-notes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/release-notes.txt,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- release-notes.txt	27 Jul 2004 21:40:08 -0000	1.58
  +++ release-notes.txt	15 Aug 2004 12:42:27 -0000	1.59
  @@ -28,6 +28,29 @@
     result set and check against the cache. If no match map all field values
     from result set to internal Map class (old version always maps all values
     from the result set to the internal Map class).
  +- replaced ojbConcreteClass by a discriminator-descriptor:
  +
  + <class-descriptor
  +       class="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest?$ExtentA?"
  +       table="EXTENT_TEST_A"
  + >
  +       <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_A"
  +      /> 
  +
  +     <field-descriptor
  +        name="objId"
  +        column="OBJ_ID"
  +        jdbc-type="INTEGER"
  +        primarykey="true"
  +        autoincrement="true"
  +     />
  + </class-descriptor>
  +
  + the discriminator is compatible with the old ojbConcreteClass. If the optional attribute
  + 'value' is not defined, the name of the class from class-descriptor is used.
   
   BUG FIXES:
   
  
  
  
  1.32      +12 -9     db-ojb/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java
  
  Index: RowReaderDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- RowReaderDefaultImpl.java	9 Aug 2004 07:45:41 -0000	1.31
  +++ RowReaderDefaultImpl.java	15 Aug 2004 12:42:28 -0000	1.32
  @@ -216,30 +216,33 @@
       protected ClassDescriptor selectClassDescriptor(Map row) throws PersistenceBrokerException
       {
           // check if there is an attribute which tells us which concrete class is to be
instantiated
  -        FieldDescriptor concreteClassFD = m_cld.getOjbConcreteClassField();
  +        FieldDescriptor discriminatorFD = m_cld.getDiscriminatorField();
   
  -        if (concreteClassFD == null)
  +        if (discriminatorFD == null)
  +        {
               return m_cld;
  +        }    
           else
           {
               try
               {
  -                String concreteClass = (String) row.get(concreteClassFD.getColumnName());
  -                if (concreteClass == null || concreteClass.trim().length() == 0)
  +                String discriminator = (String) row.get(discriminatorFD.getColumnName());
  +                if (discriminator == null || discriminator.trim().length() == 0)
                   {
                       throw new PersistenceBrokerException(
  -                            "ojbConcreteClass field returned null or 0-length string");
  +                            "discriminator field returned null or 0-length string");
                   }
                   else
                   {
  -                    concreteClass = concreteClass.trim();
  +                    discriminator = discriminator.trim();
                   }
  -                ClassDescriptor result = m_cld.getRepository().getDescriptorFor(concreteClass);
  +                
  +                ClassDescriptor result = m_cld.getRepository().getDescriptorForDiscriminator(m_cld,discriminator);
                   if (result == null)
                   {
                       LoggerFactory.getDefaultLogger().warn(
                               "[" + RowReaderDefaultImpl.class.getName()
  -                            + "] Can not find class-descriptor for ojbConcreteClass " +
concreteClass
  +                            + "] Can not find class-descriptor for discriminator " + discriminator
                               + ", use given class-descriptor '" + m_cld.getClassNameOfObject()
                               + "' instead");
                       result = m_cld;
  
  
  
  1.122     +41 -34    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.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- repository_junit.xml	13 Aug 2004 14:25:43 -0000	1.121
  +++ repository_junit.xml	15 Aug 2004 12:42:28 -0000	1.122
  @@ -26,6 +26,7 @@
         <documentation>This is important documentation on the Article class.</documentation>
         <extent-class class-ref="org.apache.ojb.broker.BookArticle" />
         <extent-class class-ref="org.apache.ojb.broker.AbstractCdArticle" />
  +
         <field-descriptor
            name="articleId"
            column="Artikel_Nr"
  @@ -508,6 +509,7 @@
         class="org.apache.ojb.broker.ObjectRepository$A"
         table="AB_TABLE"
      >
  +
         <field-descriptor
            name="id"
            column="ID"
  @@ -1020,7 +1022,7 @@
         </collection-descriptor>
      </class-descriptor>
   
  -<class-descriptor
  +<!--class-descriptor
      	  class="org.apache.ojb.broker.PersistenceAwarePerson"
      	  table="PERSON"
      >
  @@ -1060,7 +1062,7 @@
            <fk-pointing-to-this-class column="PERSON_ID"/>
            <fk-pointing-to-element-class column="PROJECT_ID"/>
         </collection-descriptor>
  -   </class-descriptor>
  +   </class-descriptor-->
   
   <!-- Definitions for org.apache.ojb.broker.PersonWithArray -->
      <class-descriptor
  @@ -2513,6 +2515,12 @@
   	class="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest$ExtentA"
   	table="EXTENT_TEST_A"
    >
  +       <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_A"
  +      />
  +
        <field-descriptor
           name="objId"
           column="OBJ_ID"
  @@ -2526,11 +2534,6 @@
          jdbc-type="VARCHAR"
        />
   
  -    <field-descriptor
  -         name="ojbConcreteClass"
  -         column="CLASS_NAME"
  -         jdbc-type="VARCHAR"
  -      />
   </class-descriptor>
   
   <class-descriptor
  @@ -2541,6 +2544,12 @@
       <extent-class class-ref="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest$ExtentE"
/>
       <extent-class class-ref="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest$ExtentF"
/>
   
  +       <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_B"
  +      />
  +
       <field-descriptor
           name="objId"
           column="OBJ_ID"
  @@ -2553,11 +2562,6 @@
          column="NAME"
          jdbc-type="VARCHAR"
        />
  -    <field-descriptor
  -         name="ojbConcreteClass"
  -         column="CLASS_NAME"
  -         jdbc-type="VARCHAR"
  -      />
   </class-descriptor>
   
   <class-descriptor
  @@ -2565,6 +2569,13 @@
   	table="EXTENT_TEST_C"
    >
       <extent-class class-ref="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest$ExtentD"
/>
  +
  +       <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_C"
  +      />
  +
       <field-descriptor
           name="objId"
           column="OBJ_ID"
  @@ -2577,17 +2588,18 @@
          column="NAME"
          jdbc-type="VARCHAR"
        />
  -    <field-descriptor
  -         name="ojbConcreteClass"
  -         column="CLASS_NAME"
  -         jdbc-type="VARCHAR"
  -      />
   </class-descriptor>
   
   <class-descriptor
   	class="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest$ExtentD"
   	table="EXTENT_TEST_D"
    >
  +        <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_D"
  +      />
  +
       <field-descriptor
           name="objId"
           column="OBJ_ID"
  @@ -2602,11 +2614,6 @@
        />
   
        <field-descriptor
  -         name="ojbConcreteClass"
  -         column="CLASS_NAME"
  -         jdbc-type="VARCHAR"
  -      />
  -     <field-descriptor
          name="dClassField"
          column="D_FIELD"
          jdbc-type="VARCHAR"
  @@ -2619,6 +2626,12 @@
   	table="EXTENT_TEST_B"
    >
   
  +       <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_E"
  +      />
  +
       <field-descriptor
           name="objId"
           column="OBJ_ID"
  @@ -2631,17 +2644,17 @@
          column="NAME"
          jdbc-type="VARCHAR"
        />
  -    <field-descriptor
  -         name="ojbConcreteClass"
  -         column="CLASS_NAME"
  -         jdbc-type="VARCHAR"
  -      />
   </class-descriptor>
   
   <class-descriptor
   	class="org.apache.ojb.broker.MultipleTableExtentAwareQueryTest$ExtentF"
   	table="EXTENT_TEST_B"
    >
  +       <discriminator-descriptor
  +         column="class_name"
  +         jdbc-type="VARCHAR"
  +         value="MTEA_Ext_F"
  +      />
   
       <field-descriptor
           name="objId"
  @@ -2655,13 +2668,7 @@
          column="NAME"
          jdbc-type="VARCHAR"
        />
  -    <field-descriptor
  -         name="ojbConcreteClass"
  -         column="CLASS_NAME"
  -         jdbc-type="VARCHAR"
  -      />
   </class-descriptor>
  -
   
   
   <class-descriptor
  
  
  
  1.58      +24 -4     db-ojb/src/test/org/apache/ojb/repository.dtd
  
  Index: repository.dtd
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository.dtd,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- repository.dtd	11 Aug 2004 00:37:32 -0000	1.57
  +++ repository.dtd	15 Aug 2004 12:42:28 -0000	1.58
  @@ -345,8 +345,8 @@
     -->
   <!ELEMENT class-descriptor
   	((documentation?, extent-class+, attribute*) |
  -	(documentation?, object-cache?, extent-class*, field-descriptor+,
  -	 reference-descriptor*, collection-descriptor*,
  +	(documentation?, object-cache?, extent-class*, discriminator-descriptor?,
  +	 field-descriptor+, reference-descriptor*, collection-descriptor*,
        index-descriptor*, attribute*,
        insert-procedure?, update-procedure?, delete-procedure?))>
   
  @@ -431,6 +431,27 @@
   >
   
   <!--
  +	The discriminator is used to discriminate the classes when multiple classes
  +	are mapped to the same table.
  +  -->
  +<!ELEMENT discriminator-descriptor (documentation?, attribute*)>
  +<!--
  +	The optional value attribute may be used to set a discriminator ie. 'my_class_a'.
  +	The default for this attribute is the name of the class taken
  +	from the class-descriptor ie 'com.myself.MyClassMappedToA'.
  +  -->
  +<!ATTLIST discriminator-descriptor
  +	column CDATA #REQUIRED
  +	jdbc-type (BIT | TINYINT | SMALLINT | INTEGER | BIGINT | DOUBLE |
  +	           FLOAT | REAL | NUMERIC | DECIMAL | CHAR | VARCHAR |
  +	           LONGVARCHAR | DATE | TIME | TIMESTAMP | BINARY |
  +	           VARBINARY | LONGVARBINARY | CLOB | BLOB | STRUCT |
  +               ARRAY | REF | BOOLEAN | DATALINK) #IMPLIED
  +	value CDATA #IMPLIED
  +	primarykey (true | false) "false"
  +>
  +
  +<!--
     A field descriptor contains mapping info for a primitive typed
     attribute of a persistent class.
   
  @@ -948,5 +969,4 @@
   	(documentation?, attribute*)>
   <!ATTLIST constant-argument
       value CDATA #REQUIRED
  ->
  -
  +>
  \ No newline at end of file
  
  
  
  1.7       +7 -4      db-ojb/src/test/org/apache/ojb/spy.properties
  
  Index: spy.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/spy.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- spy.properties	5 Apr 2004 13:58:59 -0000	1.6
  +++ spy.properties	15 Aug 2004 12:42:28 -0000	1.7
  @@ -58,7 +58,7 @@
   # realdriver=oracle.jdbc.driver.OracleDriver
   
   # mysql Connector/J driver
  -# realdriver=com.mysql.jdbc.Driver
  +#realdriver=com.mysql.jdbc.Driver
   
   # informix driver
   # realdriver=com.informix.jdbc.IfxDriver
  @@ -75,6 +75,9 @@
   # the hsqldb jdbc driver (OJB testsuite and tutorials)
   realdriver=org.hsqldb.jdbcDriver
   
  +# the sapdb jdbc driver (OJB testsuite and tutorials)
  +#realdriver=com.sap.dbtech.jdbc.DriverSapDB
  +
   #specifies another driver to use
   realdriver2=
   #specifies a third driver to use
  @@ -157,8 +160,8 @@
   
   #specifies the appender to use for logging
   #appender=com.p6spy.engine.logging.appender.Log4jLogger
  -#appender=com.p6spy.engine.logging.appender.StdoutLogger
  -appender=com.p6spy.engine.logging.appender.FileLogger
  +appender=com.p6spy.engine.logging.appender.StdoutLogger
  +#appender=com.p6spy.engine.logging.appender.FileLogger
   
   # name of logfile to use, note Windows users should make sure to use forward slashes in
their pathname (e:/test/spy.log) (used for file logger only)
   logfile     = spy.log
  @@ -238,4 +241,4 @@
   #jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces
   
   #jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
  -#jndicontextproviderurl=iiop://localhost:900
  +#jndicontextproviderurl=iiop://localhost:900
  \ No newline at end of file
  
  
  
  1.37      +1 -0      db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java
  
  Index: RepositoryTags.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- RepositoryTags.java	11 Aug 2004 00:41:47 -0000	1.36
  +++ RepositoryTags.java	15 Aug 2004 12:42:28 -0000	1.37
  @@ -70,6 +70,7 @@
           table.put("class-descriptor", new Integer(CLASS_DESCRIPTOR));
           table.put("class", new Integer(CLASS_NAME));
           table.put("proxy", new Integer(CLASS_PROXY));
  +        table.put("discriminator-descriptor", new Integer(CLASS_DISCRIMINATOR));
           table.put("extent-class", new Integer(CLASS_EXTENT));
           table.put("extends", new Integer(EXTENDS));
           table.put("table", new Integer(TABLE_NAME));
  
  
  
  1.37      +2 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java
  
  Index: RepositoryElements.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- RepositoryElements.java	4 Apr 2004 23:53:34 -0000	1.36
  +++ RepositoryElements.java	15 Aug 2004 12:42:28 -0000	1.37
  @@ -45,6 +45,7 @@
       public static final int CLASS_NAME = 13;
       public static final int CLASS_PROXY = 35;
       public static final int CLASS_EXTENT = 33;
  +    public static final int CLASS_DISCRIMINATOR = 115;
       public static final int EXTENDS = 76;
       public static final int TABLE_NAME = 14;
       public static final int ORDERBY = 36;
  @@ -141,7 +142,7 @@
       public static final int PROXY_PREFETCHING_LIMIT = 114;
   
       // maintain a next id to keep track where we are
  -    static final int _NEXT = 115;
  +    static final int _NEXT = 116;
   
       // String constants
       public static final String TAG_ACCESS = "access";
  
  
  
  1.90      +35 -14    db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
  
  Index: ClassDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- ClassDescriptor.java	11 Aug 2004 00:41:46 -0000	1.89
  +++ ClassDescriptor.java	15 Aug 2004 12:42:28 -0000	1.90
  @@ -121,11 +121,6 @@
       private transient Constructor zeroArgumentConstructor = null;
   
       /**
  -     * used to signal use of ojbConcreteClass field
  -     */
  -    private transient boolean ojbConcreteFieldCheckDone = false;
  -    private transient FieldDescriptor ojbConcreteClassField;
  -    /**
        * We have to bound {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
        * instance to this class, because metadata may change.
        */
  @@ -216,6 +211,7 @@
       //-----------------------------------------------------------------
       //-----------------------------------------------------------------
       private FieldDescriptor m_autoIncrementField = null;
  +    private FieldDescriptor m_discriminatorField = null;
       /**
        * the FieldDescriptors for the primitive attributes
        */
  @@ -2074,16 +2070,11 @@
   
       /**
        * Returns the ojbConcreteClass field or <code>null</code> if none defined.
  +     * @deprecated use getDiscriminatorField()
        */
       public FieldDescriptor getOjbConcreteClassField()
       {
  -        // if not checked before
  -        if(!ojbConcreteFieldCheckDone)
  -        {
  -            ojbConcreteClassField = getFieldDescriptorByName(OJB_CONCRETE_CLASS);
  -            ojbConcreteFieldCheckDone = true;
  -        }
  -        return ojbConcreteClassField;
  +        return getDiscriminatorField();
       }
   
       public StatementsForClassIF getStatementsForClass(PersistenceBroker broker)
  @@ -2104,12 +2095,42 @@
   		this.persistentFieldClassName = pfClassName;
       }
   
  -
       /**
        * @return
        */
       public String getPersistentFieldClassName()
       {
   		return persistentFieldClassName;
  +    }
  +
  +    /**
  +     * @return Returns the discriminatorField value, null if none.
  +     */
  +    public String getDiscriminatorValue()
  +    {
  +        String result = null;
  +        FieldDescriptor fd = getDiscriminatorField();
  +        
  +        if (fd != null)
  +        {
  +            result = fd.getPersistentField().get(null).toString();
  +        }
  +        return result;
  +    }
  +
  +    /**
  +     * @return Returns the discriminatorField.
  +     */
  +    public FieldDescriptor getDiscriminatorField()
  +    {
  +        return m_discriminatorField;
  +    }
  +    
  +    /**
  +     * @param discriminatorField The discriminatorField to set.
  +     */
  +    public void setDiscriminatorField(FieldDescriptor discriminatorField)
  +    {
  +        m_discriminatorField = discriminatorField;
       }
   }
  
  
  
  1.60      +35 -19    db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java
  
  Index: RepositoryXmlHandler.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- RepositoryXmlHandler.java	11 Aug 2004 00:41:47 -0000	1.59
  +++ RepositoryXmlHandler.java	15 Aug 2004 12:42:28 -0000	1.60
  @@ -38,7 +38,7 @@
    * metadata, one for pc object metadata.
    * </p>
    * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
  - * @author Jakob Br?uchi
  + * @author Jakob Braeuchi
    * @version $Id$
    */
   public class RepositoryXmlHandler
  @@ -340,6 +340,23 @@
                           break;
                       }
   
  +                case CLASS_DISCRIMINATOR:
  +                {
  +                    if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_DISCRIMINATOR));
  +                    String columnName = atts.getValue(RepositoryTags.getTagById(COLUMN_NAME));
  +                    String jdbcType = atts.getValue(RepositoryTags.getTagById(JDBC_TYPE));
  +                    String value = atts.getValue(RepositoryTags.getTagById(VALUE));
  +
  +                    DiscriminatorFieldDescriptor fld = new DiscriminatorFieldDescriptor(m_CurrentCLD);
  +                    fld.setColumnName(columnName);
  +                    fld.setColumnType(jdbcType);
  +                    fld.setValue(value); 
  +                    
  +                    m_CurrentCLD.addFieldDescriptor(fld);
  +
  +                    break;
  +                }
  +                    
                   case FIELD_DESCRIPTOR:
                       {
                           if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(FIELD_DESCRIPTOR));
  @@ -347,36 +364,35 @@
                           String strId = atts.getValue(RepositoryTags.getTagById(ID));
                           m_lastId = (strId == null ? m_lastId + 1 : Integer.parseInt(strId));
   
  +                        String fieldName = atts.getValue(RepositoryTags.getTagById(FIELD_NAME));
  +                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(FIELD_NAME)
+ ": " + fieldName);
  +
                           String strAccess = atts.getValue(RepositoryTags.getTagById(ACCESS));
   
  -                        if (RepositoryElements.TAG_ACCESS_ANONYMOUS.equalsIgnoreCase(strAccess))
  +                        if (fieldName.equals(ClassDescriptor.OJB_CONCRETE_CLASS))
                           {
  -                            m_CurrentFLD = new AnonymousFieldDescriptor(m_CurrentCLD, m_lastId);
  +                            DiscriminatorFieldDescriptor fld = new DiscriminatorFieldDescriptor(m_CurrentCLD);
  +                            m_CurrentFLD = fld;
                           }
  -                        else
  -                        {
  -                            m_CurrentFLD = new FieldDescriptor(m_CurrentCLD, m_lastId);
  -                        }
  -                        m_CurrentFLD.setAccess(strAccess);
  -                        m_CurrentCLD.addFieldDescriptor(m_CurrentFLD);
  -
  -                        // prepare for custom attributes
  -                        this.m_CurrentAttrContainer = this.m_CurrentFLD;
  -
  -                        String fieldName = atts.getValue(RepositoryTags.getTagById(FIELD_NAME));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(FIELD_NAME)
+ ": " + fieldName);
  -
  -                        if (RepositoryElements.TAG_ACCESS_ANONYMOUS.equalsIgnoreCase(strAccess))
  +                        else if (RepositoryElements.TAG_ACCESS_ANONYMOUS.equalsIgnoreCase(strAccess))
                           {
  -							AnonymousFieldDescriptor anonymous = (AnonymousFieldDescriptor) m_CurrentFLD;
  +							AnonymousFieldDescriptor anonymous = new AnonymousFieldDescriptor(m_CurrentCLD,
m_lastId);
                               anonymous.setPersistentField(null,fieldName);
  +                            m_CurrentFLD = anonymous;
                           }
                           else
                           {
  +                            m_CurrentFLD = new FieldDescriptor(m_CurrentCLD, m_lastId);
                               String classname = m_CurrentCLD.getClassNameOfObject();
   							PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),ClassHelper.getClass(classname),fieldName);
                               m_CurrentFLD.setPersistentField(pf);
                           }
  +                        
  +                        m_CurrentFLD.setAccess(strAccess);
  +                        m_CurrentCLD.addFieldDescriptor(m_CurrentFLD);
  +
  +                        // prepare for custom attributes
  +                        this.m_CurrentAttrContainer = this.m_CurrentFLD;
   
                           String columnName = atts.getValue(RepositoryTags.getTagById(COLUMN_NAME));
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(COLUMN_NAME)
+ ": " + columnName);
  
  
  
  1.54      +44 -2     db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
  
  Index: DescriptorRepository.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- DescriptorRepository.java	4 Aug 2004 00:27:09 -0000	1.53
  +++ DescriptorRepository.java	15 Aug 2004 12:42:28 -0000	1.54
  @@ -318,7 +318,6 @@
       }
   
       /**
  -     *
        * Utility method to discover all concrete subclasses of a given super class. <br>
        * This method was introduced in order to get Extent Aware Iterators.
        *
  @@ -406,6 +405,49 @@
       public ClassDescriptor getDescriptorFor(Class c) throws ClassNotPersistenceCapableException
       {
           return this.getDescriptorFor(c.getName());
  +    }
  +
  +    /**
  +     * Lookup a ClassDescriptor by it's discriminator. 
  +     * The search starts in the Classdescriptor aCld.
  +     * @param aCld the entry point classDescriptor
  +     * @param aDiscriminator the discriminator
  +     */
  +    public ClassDescriptor getDescriptorForDiscriminator(ClassDescriptor aCld, String aDiscriminator)
throws ClassNotPersistenceCapableException
  +    {
  +        // discriminator may be the classname
  +        ClassDescriptor result = (ClassDescriptor) descriptorTable.get(aDiscriminator);
  +        
  +        if (result == null)
  +        {
  +            Collection clds = new ArrayList();
  +            
  +            if (!aCld.isInterface())
  +            {
  +                clds.add(aCld);
  +            }    
  +            clds.addAll(getAllConcreteSubclassDescriptors(aCld));
  +            
  +            Iterator iter = clds.iterator();
  +            while (iter.hasNext())
  +            {
  +                ClassDescriptor cld = (ClassDescriptor)iter.next();
  +                String discr = cld.getDiscriminatorValue();
  +                if (aDiscriminator.equals(discr))
  +                {
  +                    result = aCld;
  +                    break;
  +                }
  +            }
  +            
  +        }
  +
  +        if (result == null)
  +        {
  +            throw new ClassNotPersistenceCapableException("No class-descriptor found for
" + aDiscriminator);
  +        }    
  +        
  +        return result;
       }
   
       /**
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/broker/metadata/DiscriminatorFieldDescriptor.java
  
  Index: DiscriminatorFieldDescriptor.java
  ===================================================================
  package org.apache.ojb.broker.metadata;
  
  /* Copyright 2002-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.commons.lang.SystemUtils;
  import org.apache.commons.lang.builder.ToStringBuilder;
  import org.apache.commons.lang.builder.ToStringStyle;
  import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
  
  /**
   * FieldDescriptor for the discriminator column for multiple classes
   * stored in the same table. 
   * This class is used for repository-entry 'discriminator-descriptor' and for
   * field-descriptor named 'ojbConcreteClass'.
   * 
   * <pre> 
   * <discriminator-descriptor
   *   column="class_name"
   *   jdbc-type="VARCHAR"
   *   value="MTEA_Ext_A"
   * />
   * </pre>
   * 
   * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
   * @version $Id: DiscriminatorFieldDescriptor.java,v 1.1 2004/08/15 12:42:28 brj Exp $
   */
  public class DiscriminatorFieldDescriptor extends FieldDescriptor
  {
      private String m_value;
  
      /**
       * Constructor. <br>
       * Sets the discriminator value to aCld.getClassNameOfObject().
       * The discriminator field is then added to the ClassDescriptor.
       * @param aCld
       */
      public DiscriminatorFieldDescriptor(ClassDescriptor aCld)
      {
          super(aCld, -1); // first field !!
  
          setRequired(true);
          setPersistentField(new DiscriminatorPersistentField());
          setAccess(ACCESS_READWRITE);
  
          m_value = getClassDescriptor().getClassNameOfObject();
  
          aCld.setDiscriminatorField(this);
      }
  
      /**
       * @return Returns the value.
       */
      public String getValue()
      {
          return m_value;
      }
  
      /**
       * @param aValue The value to set.
       * if aValue is null use the name of the class from class-descriptor 
       */
      public void setValue(String aValue)
      {
          if (aValue == null)
          {
              m_value = getClassDescriptor().getClassNameOfObject();
          }
          else
          {
              m_value = aValue;
          }
      }
  
      /**
       * Returns a string representation of this class.
       */
      public String toString()
      {
          ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
          buf.append("columnName", getColumnName());
          buf.append("columnType", getColumnType());
          buf.append("value", getValue());
          buf.append("isPrimaryKey", isPrimaryKey());
          buf.append(SystemUtils.LINE_SEPARATOR);
          return buf.toString();
      }
  
      /*
       * @see XmlCapable#toXML()
       */
      public String toXML()
      {
          String eol = SystemUtils.LINE_SEPARATOR;
  
          //opening tag + attributes
          StringBuffer result = new StringBuffer(1024);
          result.append("      ");
          result.append(RepositoryTags.getOpeningTagNonClosingById(CLASS_DISCRIMINATOR));
          result.append(" ");
          result.append(eol);
  
          // table not yet implemented
  
          // column
          result.append("        ");
          result.append(RepositoryTags.getAttribute(COLUMN_NAME, getColumnName()));
          result.append(eol);
  
          // jdbc-type
          result.append("        ");
          result.append(RepositoryTags.getAttribute(JDBC_TYPE, getColumnType()));
          result.append(eol);
  
          // primarykey
          if (isPrimaryKey())
          {
              result.append("        ");
              result.append(RepositoryTags.getAttribute(PRIMARY_KEY, "true"));
              result.append(eol);
          }
  
          // value if not default
          if (!getValue().equals(getClassDescriptor().getClassNameOfObject()))
          {
              result.append("        ");
              result.append(RepositoryTags.getAttribute(VALUE, getValue()));
              result.append(eol);
          }
          
          result.append("      />");
          result.append(eol);
          return result.toString();
      }
  
      /**
       * PersistentField returning the discriminator value. 
       */
      private class DiscriminatorPersistentField implements PersistentField
      {
          /**
           * Return the value of the discriminator.
           * @param ignoreObj the object is not used
           * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#get(java.lang.Object)
           */
          public Object get(Object ignoreObj) throws MetadataException
          {
              return getValue();
          }
  
          /**
           * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#getDeclaringClass()
           */
          public Class getDeclaringClass()
          {
              return null;
          }
  
          /**
           * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#getName()
           */
          public String getName()
          {
              return ClassDescriptor.OJB_CONCRETE_CLASS;
          }
  
          /**
           * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#getType()
           */
          public Class getType()
          {
              return null;
          }
  
          /**
           * The value the discriminator is immutable.
           * @param ignoreObj the object is not used
           * @param ignoreValue the value is not used
           * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#set(java.lang.Object,
java.lang.Object)
           */
          public void set(Object ignoreObj, Object ignoreValue) throws MetadataException
          {
              // the value cannot be changed
          }
  
          /**
           * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#usesAccessorsAndMutators()
           */
          public boolean usesAccessorsAndMutators()
          {
              return false;
          }
      }
  
  }
  
  
  1.2       +2 -0      db-ojb/src/java/org/apache/ojb/dirty/ObjectRegistrationListener.java
  
  Index: ObjectRegistrationListener.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/dirty/ObjectRegistrationListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ObjectRegistrationListener.java	9 Aug 2004 23:38:31 -0000	1.1
  +++ ObjectRegistrationListener.java	15 Aug 2004 12:42:29 -0000	1.2
  @@ -29,6 +29,7 @@
   
       public void beforeInsert(PBLifeCycleEvent event) throws PersistenceBrokerException
       {
  +        System.out.println("beforeInsert: " + event);
       }
   
       public void afterInsert(PBLifeCycleEvent event) throws PersistenceBrokerException
  @@ -37,6 +38,7 @@
   
       public void beforeUpdate(PBLifeCycleEvent event) throws PersistenceBrokerException
       {
  +        System.out.println("beforeUpdate: " + event);
       }
   
       public void afterUpdate(PBLifeCycleEvent event) throws PersistenceBrokerException
  
  
  
  1.44      +61 -0     db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
  
  Index: PersistenceBrokerTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- PersistenceBrokerTest.java	13 Jul 2004 11:37:56 -0000	1.43
  +++ PersistenceBrokerTest.java	15 Aug 2004 12:42:29 -0000	1.44
  @@ -698,6 +698,67 @@
           assertEquals("collection size", 6, allLMNO.size());
           assertEquals("counted size", 6, broker.getCount(q));
       }
  +
  +    /**
  +     * performs a test of an extent with one concrete class that uses
  +     * ojbConcreteClass identifier.
  +     */
  +    public void testMixedMapping3() throws Exception
  +    {
  +        // first delete all ObjectRepository.ABEs from database
  +        Collection allABE = null;
  +        Criteria c = null;
  +        Query q = QueryFactory.newQuery(ObjectRepository.ABE.class, c);
  +        allABE = broker.getCollectionByQuery(q);
  +        broker.beginTransaction();
  +        if (allABE != null)
  +        {
  +            Iterator iter = allABE.iterator();
  +            while (iter.hasNext())
  +            {
  +                broker.delete(iter.next());
  +            }
  +        }
  +        broker.commitTransaction();
  +
  +        // Insert 2 ObjectRepository.A
  +        ObjectRepository.A a1 = new ObjectRepository.A();
  +        ObjectRepository.A a2 = new ObjectRepository.A();
  +
  +        // Insert 1 ObjectRepository.B
  +        ObjectRepository.B b1 = new ObjectRepository.B();
  +
  +        // Insert 1 ObjectRepository.E
  +        ObjectRepository.E e1 = new ObjectRepository.E();
  +
  +        broker.beginTransaction();
  +        broker.store(a1);
  +        broker.store(a2);
  +        broker.store(b1);
  +        broker.store(e1);
  +        broker.commitTransaction();
  +        
  +        Identity ida1 = new Identity(a1,broker);
  +        Identity ide1 = new Identity(e1,broker);
  +        
  +        Criteria selectAll = null;
  +
  +        q = QueryFactory.newQuery(ObjectRepository.ABE.class, selectAll);
  +        allABE = broker.getCollectionByQuery(q);
  +        assertEquals("collection size", 4, allABE.size());
  +        assertEquals("counted size", 4, broker.getCount(q));
  +
  +        broker.beginTransaction();
  +        broker.delete(a1);
  +        broker.delete(e1);
  +        broker.commitTransaction();
  +        broker.clearCache();
  +
  +        q = QueryFactory.newQuery(ObjectRepository.ABE.class, selectAll);
  +        allABE = broker.getCollectionByQuery(q);
  +        assertEquals("collection size", 2, allABE.size());
  +        assertEquals("counted size", 2, broker.getCount(q));
  +    }
       
       /**
        * performs a test of the inheritance mapping to one table.
  
  
  
  1.63      +21 -16    db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java
  
  Index: BrokerHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- BrokerHelper.java	11 Aug 2004 00:41:49 -0000	1.62
  +++ BrokerHelper.java	15 Aug 2004 12:42:29 -0000	1.63
  @@ -27,13 +27,14 @@
   import java.util.StringTokenizer;
   import java.util.WeakHashMap;
   
  +
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.ManageableCollection;
  +import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBrokerSQLException;
  -import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.accesslayer.StatementManagerIF;
   import org.apache.ojb.broker.accesslayer.sql.SqlExistStatement;
   import org.apache.ojb.broker.core.PersistenceBrokerImpl;
  @@ -45,7 +46,6 @@
   import org.apache.ojb.broker.metadata.FieldDescriptor;
   import org.apache.ojb.broker.metadata.FieldHelper;
   import org.apache.ojb.broker.metadata.MetadataException;
  -import org.apache.ojb.broker.metadata.MetadataManager;
   import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.platforms.Platform;
  @@ -846,12 +846,13 @@
       public Query setConcreteClassCriteria(QueryByCriteria aQuery, ClassDescriptor aCld)
       {
           Query result = aQuery;
  -        FieldDescriptor fd = aCld.getFieldDescriptorByName(ClassDescriptor.OJB_CONCRETE_CLASS);
  +        FieldDescriptor fd = aCld.getDiscriminatorField();
           
           if (fd != null)
           {
  +            String discriminator = aCld.getDiscriminatorValue();
               QueryByCriteria copyQuery = QueryFactory.copyQuery(aQuery);
  -            copyQuery.getCriteria().addEqualTo(ClassDescriptor.OJB_CONCRETE_CLASS, aCld.getClassNameOfObject());
  +            copyQuery.getCriteria().addEqualTo(fd.getAttributeName(), discriminator);
               result = copyQuery;
           }
           
  @@ -859,27 +860,29 @@
       }
   
       /**
  -     * Add a Criteria for Concrete Classes to the copied Query.<br>
  -     * use addEqualTo() if the List contains only 1 element, addIn() if it contains more
elements  
  +     * Add a criteria for concrete classes to the copied query.<br>
  +     * use addEqualTo() if the list contains only 1 element, addIn() if it contains more
elements  
        * @param aQuery
  -     * @param concreteClasses
  -     * @return a copy of the Query
  +     * @param cldinfo
  +     * @return a copy of the qery including the additional criteria
        */
  -    public Query setConcreteClassCriteria(QueryByCriteria aQuery, List concreteClasses)
  +    public Query setConcreteClassCriteria(QueryByCriteria aQuery, CldInfo cldinfo)
       {
           Query result = aQuery;
  +        List concreteClasses = cldinfo.concreteClasses;
  +        FieldDescriptor fd = cldinfo.cld.getDiscriminatorField();
           
  -        if (concreteClasses != null && !concreteClasses.isEmpty())
  +        if (fd != null && concreteClasses != null && !concreteClasses.isEmpty())
           {
               QueryByCriteria copyQuery = QueryFactory.copyQuery(aQuery);
               
               if (concreteClasses.size() > 1)
               {
  -                copyQuery.getCriteria().addIn(ClassDescriptor.OJB_CONCRETE_CLASS, concreteClasses);
  +                copyQuery.getCriteria().addIn(fd.getAttributeName(), concreteClasses);
               }
               else
               {
  -                copyQuery.getCriteria().addEqualTo(ClassDescriptor.OJB_CONCRETE_CLASS,
concreteClasses.get(0));                
  +                copyQuery.getCriteria().addEqualTo(fd.getAttributeName(), concreteClasses.get(0));
               
               }
               
               result = copyQuery;
  @@ -995,7 +998,7 @@
   
               if (cldsOfTable != null)
               {
  -                FieldDescriptor fd = cld.getFieldDescriptorByName(ClassDescriptor.OJB_CONCRETE_CLASS);
  +                FieldDescriptor fd = cld.getDiscriminatorField();
                   CldInfo cldInfo = new CldInfo();
                   cldInfo.cld = (ClassDescriptor) cldsOfTable.get(0);
   
  @@ -1004,13 +1007,15 @@
                       ArrayList concreteClasses = new ArrayList(cldsOfTable.size());
                       for (int i = 0; i < cldsOfTable.size(); i++)
                       {
  -                        concreteClasses.add(((ClassDescriptor) cldsOfTable.get(i)).getClassNameOfObject());
  +                        ClassDescriptor concreteCld = (ClassDescriptor) cldsOfTable.get(i);
  +                        Object value = concreteCld.getDiscriminatorValue();
  +                        concreteClasses.add(value);
                       }
                       cldInfo.concreteClasses = concreteClasses;
                   }
   
                   result.add(cldInfo);
  -                tableMap.remove(cld.getFullTableName()); // table done
  +                tableMap.remove(cld.getFullTableName()); // table done, remove it
               }
           }
   
  
  
  

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