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/java/org/apache/ojb/odmg ObjectEnvelope.java
Date Thu, 10 Mar 2005 17:55:32 GMT
arminw      2005/03/10 09:55:31

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE ReportQueryRsIterator.java
                        SqlBasedReportQueryRsIterator.java
               src/java/org/apache/ojb/broker/cache Tag: OJB_1_0_RELEASE
                        ObjectCacheTwoLevelImpl.java
               src/java/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
                        FieldDescriptor.java JdbcType.java
               src/java/org/apache/ojb/broker/platforms Tag:
                        OJB_1_0_RELEASE PlatformOracle9iImpl.java
                        PlatformWLOracle9iImpl.java
               src/java/org/apache/ojb/broker/util/sequence Tag:
                        OJB_1_0_RELEASE SequenceManager.java
                        SequenceManagerMSSQLGuidImpl.java
               src/java/org/apache/ojb/broker/util Tag: OJB_1_0_RELEASE
                        JdbcTypesHelper.java
               src/java/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        ObjectEnvelope.java
  Added:       src/java/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
                        FieldType.java FieldTypeClasses.java
                        JdbcTypesHelper.java
  Log:
  - Introduce new interface FieldType. FieldType is the java side type of the jdbc/java type mapping (e.g. String for VARCHAR). FieldType has methods to copy and compare fields.
  - Move JdbcTypesHelper from broker.util to .broker.metadata-package
  - Adapt classes using JdbcTypesHelper
  - add method to copy field values in FieldDesciptor
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.13.2.1  +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/ReportQueryRsIterator.java
  
  Index: ReportQueryRsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ReportQueryRsIterator.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- ReportQueryRsIterator.java	4 Apr 2004 23:53:31 -0000	1.13
  +++ ReportQueryRsIterator.java	10 Mar 2005 17:55:30 -0000	1.13.2.1
  @@ -21,7 +21,7 @@
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.core.PersistenceBrokerImpl;
   import org.apache.ojb.broker.query.ReportQuery;
  -import org.apache.ojb.broker.util.JdbcTypesHelper;
  +import org.apache.ojb.broker.metadata.JdbcTypesHelper;
   
   /**
    * RsIterator for ReportQueries
  
  
  
  1.11.2.1  +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/SqlBasedReportQueryRsIterator.java
  
  Index: SqlBasedReportQueryRsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/SqlBasedReportQueryRsIterator.java,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- SqlBasedReportQueryRsIterator.java	4 Apr 2004 23:53:31 -0000	1.11
  +++ SqlBasedReportQueryRsIterator.java	10 Mar 2005 17:55:30 -0000	1.11.2.1
  @@ -20,7 +20,7 @@
   
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.core.PersistenceBrokerImpl;
  -import org.apache.ojb.broker.util.JdbcTypesHelper;
  +import org.apache.ojb.broker.metadata.JdbcTypesHelper;
   
   /**
    * ReporQueryRsIterator based on SQL-Statement
  
  
  
  No                   revision
  No                   revision
  1.1.2.4   +21 -4     db-ojb/src/java/org/apache/ojb/broker/cache/Attic/ObjectCacheTwoLevelImpl.java
  
  Index: ObjectCacheTwoLevelImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/cache/Attic/ObjectCacheTwoLevelImpl.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ObjectCacheTwoLevelImpl.java	19 Feb 2005 20:11:31 -0000	1.1.2.3
  +++ ObjectCacheTwoLevelImpl.java	10 Mar 2005 17:55:30 -0000	1.1.2.4
  @@ -445,8 +445,22 @@
        */
       public void beforeClose(PBStateEvent event)
       {
  -        if(log.isDebugEnabled()) log.debug("Clearing the session cache");
  -        resetSessionCache();
  +        /*
  +        arminw:
  +        this is a workaround for use in managed environments. When a PB instance is used
  +        within a container a PB.close call is done when leave the container method. This close
  +        the PB handle (but the real instance is still in use) and the PB listener are notified.
  +        But the JTA tx was not committed at
  +        this point in time and the session cache should not be cleared, because the updated/new
  +        objects will be pushed to the real cache on commit call (if we clear, nothing to push).
  +        So we check if the real broker is in a local tx (in this case we are in a JTA tx and the handle
  +        is closed), if true we don't reset the session cache.
  +        */
  +        if(!broker.isInTransaction())
  +        {
  +            if(log.isDebugEnabled()) log.debug("Clearing the session cache");
  +            resetSessionCache();
  +        }
       }
   
       /**
  @@ -535,7 +549,10 @@
               for(int i = 0; i < flds.length; i++)
               {
                   fld = flds[i];
  -                fld.getPersistentField().set(target, fld.getPersistentField().get(obj));
  +                // get copy of the field
  +                Object copy = fld.copyFieldValue(obj);
  +                // set the copied field value in new object
  +                fld.getPersistentField().set(target, copy);
               }
               return target;
           }
  
  
  
  No                   revision
  No                   revision
  1.36.2.1  +70 -4     db-ojb/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java
  
  Index: FieldDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java,v
  retrieving revision 1.36
  retrieving revision 1.36.2.1
  diff -u -r1.36 -r1.36.2.1
  --- FieldDescriptor.java	13 Jun 2004 08:26:00 -0000	1.36
  +++ FieldDescriptor.java	10 Mar 2005 17:55:30 -0000	1.36.2.1
  @@ -26,7 +26,6 @@
   import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
   import org.apache.ojb.broker.accesslayer.conversions.FieldConversionDefaultImpl;
   import org.apache.ojb.broker.util.ClassHelper;
  -import org.apache.ojb.broker.util.JdbcTypesHelper;
   
   /**
    * A FieldDescriptor holds the mapping information for a specific member-variable
  @@ -147,6 +146,17 @@
           m_jdbcType = lookupJdbcType();
       }
   
  +    /**
  +     * Returns the corresponding database {@link JdbcType}) of this field,
  +     * defined by the JDBC 3.0 specification, e.g. <em>VARCHAR</em>, <em>VARBINARY</em> ...
  +     * <p/>
  +     * The complement class is {@link FieldType}) which manage the java field
  +     * type, e.g. a <em>String</em>, <em>byte[]</em> ...
  +     *
  +     * Returns the mapped jdbc type of this field (see complement {@link FieldType}), defined by
  +     * the JDBC specification.
  +     * @return The jdbc database type of this field.
  +     */
       public JdbcType getJdbcType()
       {
           // check for 'null' in any case, because after serialisation
  @@ -173,16 +183,72 @@
           // to determine sql type by reflection
           if (columnType == null)
           {
  -            result = JdbcTypesHelper.getJdbcTypeByReflection(m_PersistentField.getType().getName());
  +            try
  +            {
  +                result = JdbcTypesHelper.getJdbcTypeByReflection(m_PersistentField.getType().getName());
  +            }
  +            catch(Exception e)
  +            {
  +                String eol = SystemUtils.LINE_SEPARATOR;
  +                throw new OJBRuntimeException("Can't automatically assign a jdbc field-type for field: "
  +                        + eol + this.toXML() + eol + "in class: " + eol + getClassDescriptor(), e);
  +            }
           }
           else
           {
  -            result = JdbcTypesHelper.getJdbcTypeByName(columnType);
  +            try
  +            {
  +                result = JdbcTypesHelper.getJdbcTypeByName(columnType);
  +            }
  +            catch(Exception e)
  +            {
  +                String eol = SystemUtils.LINE_SEPARATOR;
  +                throw new OJBRuntimeException("Can't assign the specified jdbc field-type '"+columnType+"' for field: "
  +                        + eol + this.toXML() + eol + "in class: " + eol + getClassDescriptor(), e);
  +            }
           }
           return result;
       }
   
       /**
  +     * Returns the {@link FieldType} of this field  defined by the
  +     * JDBC 3.0 specification, e.g. a <em>String</em>, <em>byte[]</em> ...
  +     * <p/>
  +     * The complement class is {@link JdbcType}) which manage the corresponding database
  +     * type, e.g. <em>VARCHAR</em>, <em>VARBINARY</em>.
  +     *
  +     * @return The jdbc java field type of this field.
  +     */
  +    public FieldType getFieldType()
  +    {
  +        return getJdbcType().getFieldType();
  +    }
  +
  +    /**
  +     * Returns a copy of the field value specified by
  +     * given persistent object. Internally method
  +     * {@link FieldType#copy(Object)} is used to create the copy
  +     * of the object.
  +     *
  +     * @param source The persistent object to copy the field
  +     * (Note: the whole object is expected, not the field to copy).
  +     * @return A copy of the field value, a field conversion is already
  +     * done.
  +     */
  +    public Object copyFieldValue(Object source)
  +    {
  +        // get the value
  +        Object value = getPersistentField().get(source);
  +        // convert value to a supported type if needed
  +        value = getFieldConversion().javaToSql(value);
  +        // copy the value
  +        value = getFieldType().copy(value);
  +        // convert back to type of the persistent class
  +        return getFieldConversion().sqlToJava(value);
  +    }
  +
  +
  +    /**
        * Returns a string representation of this class.
        */
       public String toString()
  
  
  
  1.6.2.1   +13 -1     db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcType.java
  
  Index: JdbcType.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcType.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- JdbcType.java	4 Apr 2004 23:53:34 -0000	1.6
  +++ JdbcType.java	10 Mar 2005 17:55:30 -0000	1.6.2.1
  @@ -21,9 +21,17 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  +
  +/**
  + * Represents a jdbc sql type object defined by the JDBC 3.0 specification to handle
  + * data conversion (see JDBC 3.0 specification <em>Appendix B, Data Type Conversion Tables</em>).
  + *
  + * @see FieldType
  + * @version $Id$
  + */
   public interface JdbcType extends Serializable
   {
  -	static final long serialVersionUID = -4280495525316102302L;    /**
  +	/**
        * Intern used flag.
        */
       public static final int MIN_INT = Integer.MIN_VALUE;
  @@ -67,6 +75,10 @@
        */
       public boolean equals(Object obj);
   
  +    /**
  +     * Returns the associated {@link FieldType} (java field type mapped to this sql type).
  +     */
  +    public FieldType getFieldType();
   
   //      // not used in code, but maybe useful in further versions
   //    /**
  
  
  
  No                   revision
  
  Index: JdbcType.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcType.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- JdbcType.java	4 Apr 2004 23:53:34 -0000	1.6
  +++ JdbcType.java	10 Mar 2005 17:55:30 -0000	1.6.2.1
  @@ -21,9 +21,17 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  +
  +/**
  + * Represents a jdbc sql type object defined by the JDBC 3.0 specification to handle
  + * data conversion (see JDBC 3.0 specification <em>Appendix B, Data Type Conversion Tables</em>).
  + *
  + * @see FieldType
  + * @version $Id$
  + */
   public interface JdbcType extends Serializable
   {
  -	static final long serialVersionUID = -4280495525316102302L;    /**
  +	/**
        * Intern used flag.
        */
       public static final int MIN_INT = Integer.MIN_VALUE;
  @@ -67,6 +75,10 @@
        */
       public boolean equals(Object obj);
   
  +    /**
  +     * Returns the associated {@link FieldType} (java field type mapped to this sql type).
  +     */
  +    public FieldType getFieldType();
   
   //      // not used in code, but maybe useful in further versions
   //    /**
  
  
  
  No                   revision
  
  Index: JdbcType.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcType.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- JdbcType.java	4 Apr 2004 23:53:34 -0000	1.6
  +++ JdbcType.java	10 Mar 2005 17:55:30 -0000	1.6.2.1
  @@ -21,9 +21,17 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  +
  +/**
  + * Represents a jdbc sql type object defined by the JDBC 3.0 specification to handle
  + * data conversion (see JDBC 3.0 specification <em>Appendix B, Data Type Conversion Tables</em>).
  + *
  + * @see FieldType
  + * @version $Id$
  + */
   public interface JdbcType extends Serializable
   {
  -	static final long serialVersionUID = -4280495525316102302L;    /**
  +	/**
        * Intern used flag.
        */
       public static final int MIN_INT = Integer.MIN_VALUE;
  @@ -67,6 +75,10 @@
        */
       public boolean equals(Object obj);
   
  +    /**
  +     * Returns the associated {@link FieldType} (java field type mapped to this sql type).
  +     */
  +    public FieldType getFieldType();
   
   //      // not used in code, but maybe useful in further versions
   //    /**
  
  
  
  1.1.2.1   +69 -0     db-ojb/src/java/org/apache/ojb/broker/metadata/Attic/FieldType.java
  
  
  
  
  1.1.2.1   +401 -0    db-ojb/src/java/org/apache/ojb/broker/metadata/Attic/FieldTypeClasses.java
  
  
  
  
  1.1.2.1   +1341 -0   db-ojb/src/java/org/apache/ojb/broker/metadata/Attic/JdbcTypesHelper.java
  
  
  
  
  No                   revision
  No                   revision
  1.13.2.2  +2 -2      db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java
  
  Index: PlatformOracle9iImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java,v
  retrieving revision 1.13.2.1
  retrieving revision 1.13.2.2
  diff -u -r1.13.2.1 -r1.13.2.2
  --- PlatformOracle9iImpl.java	25 Feb 2005 19:08:15 -0000	1.13.2.1
  +++ PlatformOracle9iImpl.java	10 Mar 2005 17:55:31 -0000	1.13.2.2
  @@ -18,7 +18,7 @@
   import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
   import org.apache.ojb.broker.metadata.JdbcType;
   import org.apache.ojb.broker.util.ClassHelper;
  -import org.apache.ojb.broker.util.JdbcTypesHelper;
  +import org.apache.ojb.broker.metadata.JdbcTypesHelper;
   
   import java.io.ByteArrayInputStream;
   import java.lang.reflect.Method;
  
  
  
  1.2.2.1   +2 -2      db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformWLOracle9iImpl.java
  
  Index: PlatformWLOracle9iImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformWLOracle9iImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- PlatformWLOracle9iImpl.java	22 May 2004 09:55:33 -0000	1.2
  +++ PlatformWLOracle9iImpl.java	10 Mar 2005 17:55:31 -0000	1.2.2.1
  @@ -27,7 +27,7 @@
   
   import org.apache.ojb.broker.metadata.JdbcType;
   import org.apache.ojb.broker.util.ClassHelper;
  -import org.apache.ojb.broker.util.JdbcTypesHelper;
  +import org.apache.ojb.broker.metadata.JdbcTypesHelper;
   
   /**
    * This class is a concrete implementation of <code>Platform</code>. Provides
  
  
  
  No                   revision
  No                   revision
  1.10.2.1  +17 -10    db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java
  
  Index: SequenceManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- SequenceManager.java	4 Apr 2004 23:53:38 -0000	1.10
  +++ SequenceManager.java	10 Mar 2005 17:55:31 -0000	1.10.2.1
  @@ -21,23 +21,21 @@
   
   /**
    * SequenceManagers are responsible for creating new unique
  - * ID's - unique accross all extent objects.
  + * ID's - unique accross all "extent" object declarations in OJB metadata.
    * There are some standard sequence manager implementations in
    * this package.
  - * SequenceManager objects are obtained from a Factory called
  + * <p/>
  + * SequenceManager objects are obtained from a factory class called
    * {@link SequenceManagerFactory}.
    * This Factory can be configured to provide instances of user defined
    * implementors of this interface.
  - *
  - * SequenceManagers should be aware of extents, that
  - * is: if you ask for an uid for an Interface (more exact for one implementor class)
  + * <p/>
  + * NOTE: SequenceManagers should be aware of "extents" ("extent" is an OJB inheritance feature),
  + * that is: if you ask for an uid for an Interface (more exact for one implementor class)
    * with several implementor classes, or a baseclass with several subclasses the returned uid
    * should be unique accross all tables representing objects of the extent in question.
    *
  - * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
  - * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
  - *
    */
   public interface SequenceManager
   {
  @@ -51,7 +49,16 @@
       public Object getUniqueValue(FieldDescriptor field) throws SequenceManagerException;
   
   
  -    /**
     * This is to support auto_increment columns on the db side
     * <p>
     * high/low and other implementations may ignore this method.
     * <p>
     * Travis Reeder
     *
     * @param cld
     * @param obj
     */
  +    /**
  +     * This is to support auto_increment columns on the db side
  +     * <p>
  +     * high/low and other implementations may ignore this method.
  +     * <p>
  +     * Travis Reeder
  +     *
  +     * @param cld
  +     * @param obj
  +     */
       public void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object obj) throws SequenceManagerException;
   
       /**
  
  
  
  1.4.2.1   +2 -2      db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMSSQLGuidImpl.java
  
  Index: SequenceManagerMSSQLGuidImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMSSQLGuidImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- SequenceManagerMSSQLGuidImpl.java	4 Apr 2004 23:53:38 -0000	1.4
  +++ SequenceManagerMSSQLGuidImpl.java	10 Mar 2005 17:55:31 -0000	1.4.2.1
  @@ -18,7 +18,7 @@
   import org.apache.commons.lang.SystemUtils;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.broker.util.JdbcTypesHelper;
  +import org.apache.ojb.broker.metadata.JdbcTypesHelper;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.apache.ojb.broker.accesslayer.ResultSetAndStatement;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
  
  
  
  No                   revision
  No                   revision
  1.11.2.1  +9 -1271   db-ojb/src/java/org/apache/ojb/broker/util/JdbcTypesHelper.java
  
  Index: JdbcTypesHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/JdbcTypesHelper.java,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- JdbcTypesHelper.java	24 Jun 2004 09:38:34 -0000	1.11
  +++ JdbcTypesHelper.java	10 Mar 2005 17:55:31 -0000	1.11.2.1
  @@ -21,6 +21,7 @@
   import java.util.Map;
   
   import org.apache.commons.lang.BooleanUtils;
  +import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.metadata.JdbcType;
   import org.apache.ojb.broker.util.sequence.SequenceManagerException;
  @@ -40,1276 +41,13 @@
    * limitations under the License.
    */
   
  -public final class JdbcTypesHelper
  +/**
  + * Helper class centralise all SQL Types operations and make
  + * available {@link JdbcType} inner class implementations.
  + *
  + * @deprecated Use {@link org.apache.ojb.broker.metadata.JdbcTypesHelper} instead.
  + * @version $Id$
  + */
  +public class JdbcTypesHelper extends org.apache.ojb.broker.metadata.JdbcTypesHelper
   {
  -    private static Map jdbcObjectTypesFromType = new HashMap();
  -    private static Map jdbcObjectTypesFromName = new HashMap();
  -
  -    /*
  -    Hold out all JdbcType in a static maps
  -    */
  -    static
  -    {
  -        jdbcObjectTypesFromType.put(new Integer(Types.ARRAY), new JdbcTypesHelper.T_Array());
  -        jdbcObjectTypesFromType.put(new Integer(Types.BIGINT), new JdbcTypesHelper.T_BigInt());
  -        jdbcObjectTypesFromType.put(new Integer(Types.BINARY), new JdbcTypesHelper.T_Binary());
  -        jdbcObjectTypesFromType.put(new Integer(Types.BIT), new JdbcTypesHelper.T_Bit());
  -        jdbcObjectTypesFromType.put(new Integer(Types.BLOB), new JdbcTypesHelper.T_Blob());
  -        jdbcObjectTypesFromType.put(new Integer(Types.CHAR), new JdbcTypesHelper.T_Char());
  -        jdbcObjectTypesFromType.put(new Integer(Types.CLOB), new JdbcTypesHelper.T_Clob());
  -        jdbcObjectTypesFromType.put(new Integer(Types.DATE), new JdbcTypesHelper.T_Date());
  -        jdbcObjectTypesFromType.put(new Integer(Types.DECIMAL), new JdbcTypesHelper.T_Decimal());
  -        jdbcObjectTypesFromType.put(new Integer(Types.DOUBLE), new JdbcTypesHelper.T_Double());
  -        jdbcObjectTypesFromType.put(new Integer(Types.FLOAT), new JdbcTypesHelper.T_Float());
  -        jdbcObjectTypesFromType.put(new Integer(Types.INTEGER), new JdbcTypesHelper.T_Integer());
  -        jdbcObjectTypesFromType.put(new Integer(Types.LONGVARBINARY), new JdbcTypesHelper.T_LongVarBinary());
  -        jdbcObjectTypesFromType.put(new Integer(Types.LONGVARCHAR), new JdbcTypesHelper.T_LongVarChar());
  -        jdbcObjectTypesFromType.put(new Integer(Types.NUMERIC), new JdbcTypesHelper.T_Numeric());
  -        jdbcObjectTypesFromType.put(new Integer(Types.REAL), new JdbcTypesHelper.T_Real());
  -        jdbcObjectTypesFromType.put(new Integer(Types.REF), new JdbcTypesHelper.T_Ref());
  -        jdbcObjectTypesFromType.put(new Integer(Types.SMALLINT), new JdbcTypesHelper.T_SmallInt());
  -        jdbcObjectTypesFromType.put(new Integer(Types.STRUCT), new JdbcTypesHelper.T_Struct());
  -        jdbcObjectTypesFromType.put(new Integer(Types.TIME), new JdbcTypesHelper.T_Time());
  -        jdbcObjectTypesFromType.put(new Integer(Types.TIMESTAMP), new JdbcTypesHelper.T_Timestamp());
  -        jdbcObjectTypesFromType.put(new Integer(Types.TINYINT), new JdbcTypesHelper.T_TinyInt());
  -        jdbcObjectTypesFromType.put(new Integer(Types.VARBINARY), new JdbcTypesHelper.T_VarBinary());
  -        jdbcObjectTypesFromType.put(new Integer(Types.VARCHAR), new JdbcTypesHelper.T_Varchar());
  -//#ifdef JDBC30
  -        jdbcObjectTypesFromType.put(new Integer(Types.BOOLEAN), new JdbcTypesHelper.T_Boolean());
  -        jdbcObjectTypesFromType.put(new Integer(Types.DATALINK), new JdbcTypesHelper.T_Datalink());
  -//#endif
  -
  -
  -        jdbcObjectTypesFromName.put("array", jdbcObjectTypesFromType.get(new Integer(Types.ARRAY)));
  -        jdbcObjectTypesFromName.put("bigint", jdbcObjectTypesFromType.get(new Integer(Types.BIGINT)));
  -        jdbcObjectTypesFromName.put("binary", jdbcObjectTypesFromType.get(new Integer(Types.BINARY)));
  -        jdbcObjectTypesFromName.put("bit", jdbcObjectTypesFromType.get(new Integer(Types.BIT)));
  -        jdbcObjectTypesFromName.put("blob", jdbcObjectTypesFromType.get(new Integer(Types.BLOB)));
  -        jdbcObjectTypesFromName.put("char", jdbcObjectTypesFromType.get(new Integer(Types.CHAR)));
  -        jdbcObjectTypesFromName.put("clob", jdbcObjectTypesFromType.get(new Integer(Types.CLOB)));
  -        jdbcObjectTypesFromName.put("date", jdbcObjectTypesFromType.get(new Integer(Types.DATE)));
  -        jdbcObjectTypesFromName.put("decimal", jdbcObjectTypesFromType.get(new Integer(Types.DECIMAL)));
  -        jdbcObjectTypesFromName.put("double", jdbcObjectTypesFromType.get(new Integer(Types.DOUBLE)));
  -        jdbcObjectTypesFromName.put("float", jdbcObjectTypesFromType.get(new Integer(Types.FLOAT)));
  -        jdbcObjectTypesFromName.put("integer", jdbcObjectTypesFromType.get(new Integer(Types.INTEGER)));
  -        jdbcObjectTypesFromName.put("longvarbinary", jdbcObjectTypesFromType.get(new Integer(Types.LONGVARBINARY)));
  -        jdbcObjectTypesFromName.put("longvarchar", jdbcObjectTypesFromType.get(new Integer(Types.LONGVARCHAR)));
  -        jdbcObjectTypesFromName.put("numeric", jdbcObjectTypesFromType.get(new Integer(Types.NUMERIC)));
  -        jdbcObjectTypesFromName.put("real", jdbcObjectTypesFromType.get(new Integer(Types.REAL)));
  -        jdbcObjectTypesFromName.put("ref", jdbcObjectTypesFromType.get(new Integer(Types.REF)));
  -        jdbcObjectTypesFromName.put("smallint", jdbcObjectTypesFromType.get(new Integer(Types.SMALLINT)));
  -        jdbcObjectTypesFromName.put("struct", jdbcObjectTypesFromType.get(new Integer(Types.STRUCT)));
  -        jdbcObjectTypesFromName.put("time", jdbcObjectTypesFromType.get(new Integer(Types.TIME)));
  -        jdbcObjectTypesFromName.put("timestamp", jdbcObjectTypesFromType.get(new Integer(Types.TIMESTAMP)));
  -        jdbcObjectTypesFromName.put("tinyint", jdbcObjectTypesFromType.get(new Integer(Types.TINYINT)));
  -        jdbcObjectTypesFromName.put("varbinary", jdbcObjectTypesFromType.get(new Integer(Types.VARBINARY)));
  -        jdbcObjectTypesFromName.put("varchar", jdbcObjectTypesFromType.get(new Integer(Types.VARCHAR)));
  -//#ifdef JDBC30
  -        jdbcObjectTypesFromName.put("boolean", jdbcObjectTypesFromType.get(new Integer(Types.BOOLEAN)));
  -        jdbcObjectTypesFromName.put("datalink", jdbcObjectTypesFromType.get(new Integer(Types.DATALINK)));
  -//#endif
  -    }
  -
  -    /**
  -     * Return the {@link JdbcType} for the given jdbc {@link Types type}.
  -     */
  -    public static JdbcType getJdbcTypeByTypesIndex(Integer type)
  -    {
  -        return (JdbcType) jdbcObjectTypesFromType.get(type);
  -    }
  -
  -    /**
  -     * Lookup the {@link JdbcType} by name. If name was not found an exception
  -     * is thrown.
  -     */
  -    public static JdbcType getJdbcTypeByName(String typeName)
  -    {
  -        JdbcType result = null;
  -        result = (JdbcType) jdbcObjectTypesFromName.get(typeName.toLowerCase());
  -        if (result == null)
  -        {
  -            throw new OJBRuntimeException("The type " + typeName + " can not be handled by OJB." +
  -                    " Please specify only types as defined by java.sql.Types.");
  -        }
  -        return result;
  -    }
  -
  -    /**
  -     * Try to automatically assign a jdbc type for the given
  -     * java type name. This method is used if e.g. in metadata a
  -     * column type was not set.
  -     *
  -     * @see org.apache.ojb.broker.metadata.FieldDescriptor#getJdbcType
  -     */
  -    public static JdbcType getJdbcTypeByReflection(String fieldType)
  -    {
  -        JdbcType result;
  -        if (fieldType.equalsIgnoreCase(Character.class.getName()) || fieldType.equalsIgnoreCase("char"))
  -            result = getJdbcTypeByName("char");
  -        else if (fieldType.equalsIgnoreCase(Short.class.getName()) || fieldType.equalsIgnoreCase("short"))
  -            result = getJdbcTypeByName("smallint");
  -        else if (fieldType.equalsIgnoreCase(Integer.class.getName()) || fieldType.equalsIgnoreCase("int"))
  -            result = getJdbcTypeByName("integer");
  -        else if (fieldType.equalsIgnoreCase(Long.class.getName()) || fieldType.equalsIgnoreCase("long"))
  -            result = getJdbcTypeByName("bigint");
  -        else if (fieldType.equalsIgnoreCase(Byte.class.getName()) || fieldType.equalsIgnoreCase("byte"))
  -            result = getJdbcTypeByName("tinyint");
  -        else if (fieldType.equalsIgnoreCase(Float.class.getName()) || fieldType.equalsIgnoreCase("float"))
  -            result = getJdbcTypeByName("real");
  -        else if (fieldType.equalsIgnoreCase(Double.class.getName()) || fieldType.equalsIgnoreCase("double"))
  -            result = getJdbcTypeByName("float");
  -        else if (fieldType.equalsIgnoreCase(String.class.getName()))
  -            result = getJdbcTypeByName("varchar");
  -        /*
  -        TODO: arminw: useful? This only will work in conjunction with  a FieldConversion
  -        */
  -        else if (fieldType.equalsIgnoreCase(java.util.Date.class.getName()))
  -            result = getJdbcTypeByName("date");
  -        else if (fieldType.equalsIgnoreCase(java.sql.Date.class.getName()))
  -            result = getJdbcTypeByName("date");
  -        else if (fieldType.equalsIgnoreCase(java.sql.Time.class.getName()))
  -            result = getJdbcTypeByName("time");
  -        else if (fieldType.equalsIgnoreCase(Timestamp.class.getName()))
  -            result = getJdbcTypeByName("timestamp");
  -        else if (fieldType.equalsIgnoreCase(BigDecimal.class.getName()))
  -            result = getJdbcTypeByName("decimal");
  -        else if (fieldType.equalsIgnoreCase(Ref.class.getName()))
  -            result = getJdbcTypeByName("ref");
  -        else if (fieldType.equalsIgnoreCase(Struct.class.getName()))
  -            result = getJdbcTypeByName("struct");
  -        else if (fieldType.equalsIgnoreCase(Boolean.class.getName()) || fieldType.equalsIgnoreCase("boolean"))
  -            result = getJdbcTypeByName("bit");
  -//#ifdef JDBC30
  -        else if (fieldType.equalsIgnoreCase(URL.class.getName()))
  -            result = getJdbcTypeByName("datalink");
  -//#endif
  -        else
  -            throw new OJBRuntimeException("The type " + fieldType + " can not be handled by OJB automatically."
  -                    + " Please specify a type as defined by java.sql.Types in your field-descriptor");
  -        return result;
  -    }
  -
  -
  -    /**
  -     * Returns an java object read from the specified ResultSet column.
  -     */
  -    public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId)
  -            throws SQLException
  -    {
  -        return getObjectFromColumn(rs, null, jdbcType, null, columnId);
  -    }
  -
  -    /**
  -     * Returns an java object for the given jdbcType by extract from the given
  -     * CallableStatement or ResultSet.
  -     * NOTE: Exactly one of the arguments of type CallableStatement or ResultSet
  -     * have to be non-null.
  -     * If the 'columnId' argument is equals {@link JdbcType#MIN_INT}, then the given 'columnName'
  -     * argument is used to lookup column. Else the given 'columnId' is used as column index.
  -     */
  -    private static Object getObjectFromColumn(ResultSet rs, CallableStatement stmt, Integer jdbcType, String columnName, int columnId)
  -            throws SQLException
  -    {
  -        return getJdbcTypeByTypesIndex(jdbcType).getObjectFromColumn(rs, stmt, columnName, columnId);
  -    }
  -
  -    /**
  -     * Returns a string representation of the given {@link Types} value.
  -     */
  -    public static String getJdbcTypeAsString(int jdbcType)
  -    {
  -        Field[] fields = Types.class.getFields();
  -        for (int i = 0; i < fields.length; i++)
  -        {
  -            try
  -            {
  -                Field field = fields[i];
  -                int temp = field.getInt(null);
  -                if (temp == jdbcType)
  -                {
  -                    return field.getName();
  -                }
  -            }
  -            catch (Exception ignore)
  -            {
  -                // ignore.printStackTrace();
  -            }
  -        }
  -        return "UNKNOWN_TYPE";
  -    }
  -
  -
  -    //======================================================================================
  -    // inner classes implementing JdbcType interface
  -    //======================================================================================
  -
  -    public abstract static class BaseType implements JdbcType
  -    {
  -        abstract Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException;
  -
  -        abstract Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException;
  -
  -        abstract Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException;
  -        /*
  -        only supported by jdk >= 1.4x, maybe useful in further versions
  -        */
  -        // abstract Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException;
  -
  -        public boolean equals(Object obj)
  -        {
  -            if (this == obj) return true;
  -            boolean result = false;
  -            if (obj instanceof JdbcType)
  -            {
  -                result = this.getType() == ((JdbcType) obj).getType();
  -            }
  -            return result;
  -        }
  -
  -        public int hashCode()
  -        {
  -            return getType();
  -        }
  -
  -        public Object getObjectFromColumn(CallableStatement stmt, int columnId) throws SQLException
  -        {
  -            return getObjectFromColumn(null, stmt, null, columnId);
  -        }
  -
  -        public Object getObjectFromColumn(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return getObjectFromColumn(rs, null, columnName, MIN_INT);
  -        }
  -
  -        public Object getObjectFromColumn(final ResultSet rs, final CallableStatement stmt,
  -                                          final String columnName, int columnIndex) throws SQLException
  -        {
  -            if (stmt != null)
  -            {
  -//                return columnIndex == MIN_INT
  -//                        ? readValueFromStatement(stmt, columnName) : readValueFromStatement(stmt, columnIndex);
  -                if (columnIndex == MIN_INT)
  -                {
  -                    throw new UnsupportedOperationException("Not implemented yet");
  -                }
  -                else
  -                {
  -                    return readValueFromStatement(stmt, columnIndex);
  -                }
  -            }
  -            else
  -            {
  -                return columnIndex == MIN_INT
  -                        ? readValueFromResultSet(rs, columnName) : readValueFromResultSet(rs, columnIndex);
  -            }
  -        }
  -
  -        public String toString()
  -        {
  -            return super.toString() + "[" + getJdbcTypeAsString(getType()) + " JDBC TYPE]";
  -        }
  -
  -//      // not used in code, but maybe useful in further versions
  -//        public Object getObjectFromColumn(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return getObjectFromColumn(null, stmt, columnName, MIN_INT);
  -//        }
  -//
  -//        public Object getObjectFromColumn(ResultSet rs, int columnId) throws SQLException
  -//        {
  -//            return getObjectFromColumn(rs, null, null, columnId);
  -//        }
  -
  -    }
  -
  -
  -    public static final class T_Char extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier.toString();
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getString(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getString(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getString(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getString(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.CHAR;
  -        }
  -    }
  -
  -    public static final class T_Varchar extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier.toString();
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getString(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getString(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getString(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getString(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.VARCHAR;
  -        }
  -    }
  -
  -    public static final class T_LongVarChar extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier.toString();
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getString(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getString(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getString(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getString(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.LONGVARCHAR;
  -        }
  -    }
  -
  -    public static final class T_Numeric extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new BigDecimal(identifier.longValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getBigDecimal(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getBigDecimal(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getBigDecimal(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getBigDecimal(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.NUMERIC;
  -        }
  -    }
  -
  -    public static final class T_Decimal extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new BigDecimal(identifier.longValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getBigDecimal(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getBigDecimal(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getBigDecimal(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getBigDecimal(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.DECIMAL;
  -        }
  -    }
  -
  -    public static final class T_Bit extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'BIT'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            boolean temp = stmt.getBoolean(columnName);
  -//            return (stmt.wasNull() ? null : new Boolean(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            boolean temp = stmt.getBoolean(columnIndex);
  -            return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            boolean temp = rs.getBoolean(columnName);
  -            return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            boolean temp = rs.getBoolean(columnIndex);
  -            return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.BIT;
  -        }
  -    }
  -
  -//#ifdef JDBC30
  -    public static final class T_Boolean extends BaseType
  -    {
  -        public Object sequenceKeyConversion(final Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'BOOLEAN'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            boolean temp = stmt.getBoolean(columnName);
  -//            return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            boolean temp = stmt.getBoolean(columnIndex);
  -            return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            boolean temp = rs.getBoolean(columnName);
  -            return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            boolean temp = rs.getBoolean(columnIndex);
  -            return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.BOOLEAN;
  -        }
  -    }
  -//#endif
  -
  -    public static final class T_TinyInt extends BaseType
  -    {
  -        public Object sequenceKeyConversion(final Long identifier) throws SequenceManagerException
  -        {
  -            return new Byte(identifier.byteValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            byte temp = stmt.getByte(columnName);
  -//            return (stmt.wasNull() ? null : new Byte(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            byte temp = stmt.getByte(columnIndex);
  -            return (stmt.wasNull() ? null : new Byte(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            byte temp = rs.getByte(columnName);
  -            return (rs.wasNull() ? null : new Byte(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            byte temp = rs.getByte(columnIndex);
  -            return (rs.wasNull() ? null : new Byte(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.TINYINT;
  -        }
  -    }
  -
  -    public static final class T_SmallInt extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Short(identifier.shortValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            short temp = stmt.getShort(columnName);
  -//            return (stmt.wasNull() ? null : new Short(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            short temp = stmt.getShort(columnIndex);
  -            return (stmt.wasNull() ? null : new Short(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            short temp = rs.getShort(columnName);
  -            return (rs.wasNull() ? null : new Short(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            short temp = rs.getShort(columnIndex);
  -            return (rs.wasNull() ? null : new Short(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.SMALLINT;
  -        }
  -    }
  -
  -    public static final class T_Integer extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Integer(identifier.intValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            int temp = stmt.getInt(columnName);
  -//            return (stmt.wasNull() ? null : new Integer(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            int temp = stmt.getInt(columnIndex);
  -            return (stmt.wasNull() ? null : new Integer(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            int temp = rs.getInt(columnName);
  -            return (rs.wasNull() ? null : new Integer(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            int temp = rs.getInt(columnIndex);
  -            return (rs.wasNull() ? null : new Integer(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.INTEGER;
  -        }
  -    }
  -
  -    public static final class T_BigInt extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier;
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            long temp = stmt.getLong(columnName);
  -//            return (stmt.wasNull() ? null : new Long(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            long temp = stmt.getLong(columnIndex);
  -            return (stmt.wasNull() ? null : new Long(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            long temp = rs.getLong(columnName);
  -            return (rs.wasNull() ? null : new Long(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            long temp = rs.getLong(columnIndex);
  -            return (rs.wasNull() ? null : new Long(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.BIGINT;
  -        }
  -    }
  -
  -    public static final class T_Real extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Float(identifier.floatValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            float temp = stmt.getFloat(columnName);
  -//            return (stmt.wasNull() ? null : new Float(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            float temp = stmt.getFloat(columnIndex);
  -            return (stmt.wasNull() ? null : new Float(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            float temp = rs.getFloat(columnName);
  -            return (rs.wasNull() ? null : new Float(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            float temp = rs.getFloat(columnIndex);
  -            return (rs.wasNull() ? null : new Float(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.REAL;
  -        }
  -    }
  -
  -    public static final class T_Float extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Double(identifier.doubleValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            double temp = stmt.getDouble(columnName);
  -//            return (stmt.wasNull() ? null : new Double(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            double temp = stmt.getDouble(columnIndex);
  -            return (stmt.wasNull() ? null : new Double(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            double temp = rs.getDouble(columnName);
  -            return (rs.wasNull() ? null : new Double(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            double temp = rs.getDouble(columnIndex);
  -            return (rs.wasNull() ? null : new Double(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.FLOAT;
  -        }
  -    }
  -
  -    public static final class T_Double extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Double(identifier.doubleValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            double temp = stmt.getDouble(columnName);
  -//            return (stmt.wasNull() ? null : new Double(temp));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            double temp = stmt.getDouble(columnIndex);
  -            return (stmt.wasNull() ? null : new Double(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            double temp = rs.getDouble(columnName);
  -            return (rs.wasNull() ? null : new Double(temp));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            double temp = rs.getDouble(columnIndex);
  -            return (rs.wasNull() ? null : new Double(temp));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.DOUBLE;
  -        }
  -    }
  -
  -    public static final class T_Binary extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier.toString().getBytes();
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getBytes(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getBytes(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getBytes(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getBytes(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.BINARY;
  -        }
  -    }
  -
  -    public static final class T_VarBinary extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier.toString().getBytes();
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getBytes(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getBytes(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getBytes(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getBytes(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.VARBINARY;
  -        }
  -    }
  -
  -    public static final class T_LongVarBinary extends BaseType
  -    {
  -        protected static final int BUFSZ = 2048;
  -
  -        /**
  -         * Retrieve LONGVARBINARY InputStream data and pack into a byte array.
  -         *
  -         * @param is the input stream to be retrieved
  -         * @return a string containing the clob data
  -         * @throws SQLException if conversion fails or the clob cannot be read
  -         */
  -        protected static byte[] retrieveStreamDataFromRs(InputStream is) throws SQLException
  -        {
  -            if (is == null)
  -            {
  -                return null;
  -            }
  -            byte[] bytes = null;
  -            ByteArrayOutputStream bos = null;
  -            try
  -            {
  -                bos = new ByteArrayOutputStream();
  -                int numRead;
  -                byte[] buf = new byte[BUFSZ];
  -                while ((numRead = is.read(buf, 0, buf.length)) > 0)
  -                {
  -                    bos.write(buf, 0, numRead);
  -                }
  -                bytes = bos.toByteArray();
  -            }
  -            catch (IOException e)
  -            {
  -                throw new SQLException("I/O exception retrieving LONGVARBINARY: " + e.getLocalizedMessage());
  -            }
  -            finally
  -            {
  -                if (bos != null)
  -                {
  -                    try
  -                    {
  -                        bos.close();
  -                    }
  -                    catch (Exception ignored)
  -                    {
  -                        //ignore
  -                    }
  -                }
  -            }
  -            return bytes;
  -        }
  -
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return identifier.toString().getBytes();
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getBytes(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getBytes(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return retrieveStreamDataFromRs(rs.getBinaryStream(columnName));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return retrieveStreamDataFromRs(rs.getBinaryStream(columnIndex));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.LONGVARBINARY;
  -        }
  -    }
  -
  -    public static final class T_Date extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Date(identifier.longValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getDate(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getDate(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getDate(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getDate(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.DATE;
  -        }
  -    }
  -
  -    public static final class T_Time extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Time(identifier.longValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getTime(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getTime(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getTime(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getTime(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.TIME;
  -        }
  -    }
  -
  -    public static final class T_Timestamp extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            return new Timestamp(identifier.longValue());
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getTimestamp(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getTimestamp(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getTimestamp(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getTimestamp(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.TIMESTAMP;
  -        }
  -    }
  -
  -    public static final class T_Clob extends BaseType
  -    {
  -        protected static final int BUFSZ = 32768;
  -
  -        /**
  -         * Convert CLOB to String. Safe for very large objects.
  -         *
  -         * @param aClob clob with character data
  -         * @return a string containing the clob data
  -         * @throws SQLException if conversion fails or the clob cannot be read
  -         */
  -        protected static String safeClobToString(Clob aClob) throws SQLException
  -        {
  -            long length = aClob.length();
  -            if (length == 0)
  -            {
  -                return "";
  -            }
  -            StringBuffer sb = new StringBuffer();
  -            char[] buf = new char[BUFSZ];
  -            java.io.Reader stream = aClob.getCharacterStream();
  -            try
  -            {
  -                int numRead;
  -                while ((numRead = stream.read(buf)) != -1)
  -                {
  -                    sb.append(buf, 0, numRead);
  -                }
  -                stream.close();
  -            }
  -            catch (java.io.IOException e)
  -            {
  -                throw new SQLException(e.getLocalizedMessage());
  -            }
  -            return sb.toString();
  -        }
  -
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'CLOB'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            Clob aClob = stmt.getClob(columnName);
  -//            return (stmt.wasNull() ? null : aClob.getSubString(1L, (int) aClob.length()));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            Clob aClob = stmt.getClob(columnIndex);
  -            return (stmt.wasNull() ? null : safeClobToString(aClob));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            Clob aClob = rs.getClob(columnName);
  -            return (rs.wasNull() ? null : safeClobToString(aClob));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            Clob aClob = rs.getClob(columnIndex);
  -            return (rs.wasNull() ? null : safeClobToString(aClob));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.CLOB;
  -        }
  -    }
  -
  -    public static final class T_Blob extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'BLOB'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            Blob aBlob = stmt.getBlob(columnName);
  -//            return (stmt.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            Blob aBlob = stmt.getBlob(columnIndex);
  -            return (stmt.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            Blob aBlob = rs.getBlob(columnName);
  -            return (rs.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            Blob aBlob = rs.getBlob(columnIndex);
  -            return (rs.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.BLOB;
  -        }
  -    }
  -
  -    public static final class T_Array extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'ARRAY'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getArray(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getArray(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getArray(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getArray(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.ARRAY;
  -        }
  -    }
  -
  -    public static final class T_Struct extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'STRUCT'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getObject(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getObject(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getObject(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getObject(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.STRUCT;
  -        }
  -    }
  -
  -    public static final class T_Ref extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'REF'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getRef(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getRef(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getRef(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getRef(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.REF;
  -        }
  -    }
  -
  -//#ifdef JDBC30
  -    public static final class T_Datalink extends BaseType
  -    {
  -        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
  -        {
  -            throw new SequenceManagerException("Not supported sequence key type 'DATALINK'");
  -        }
  -
  -//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
  -//        {
  -//            return stmt.getURL(columnName);
  -//        }
  -
  -        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
  -        {
  -            return stmt.getURL(columnIndex);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
  -        {
  -            return rs.getURL(columnName);
  -        }
  -
  -        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
  -        {
  -            return rs.getURL(columnIndex);
  -        }
  -
  -        public int getType()
  -        {
  -            return Types.DATALINK;
  -        }
  -    }
  -//#endif
   }
  
  
  
  No                   revision
  No                   revision
  1.32.2.7  +7 -4      db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelope.java
  
  Index: ObjectEnvelope.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelope.java,v
  retrieving revision 1.32.2.6
  retrieving revision 1.32.2.7
  diff -u -r1.32.2.6 -r1.32.2.7
  --- ObjectEnvelope.java	24 Feb 2005 17:12:18 -0000	1.32.2.6
  +++ ObjectEnvelope.java	10 Mar 2005 17:55:31 -0000	1.32.2.7
  @@ -38,10 +38,10 @@
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
   import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
  -import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.util.ObjectModification;
   import org.apache.ojb.broker.util.ObjectModificationDefaultImpl;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  +import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.odmg.states.ModificationState;
   import org.apache.ojb.odmg.states.StateNewDirty;
   import org.apache.ojb.odmg.states.StateOldClean;
  @@ -55,6 +55,8 @@
   public class ObjectEnvelope implements ObjectModification
   {
       static final long serialVersionUID = -829177767933340522L;
  +    private Logger log = LoggerFactory.getLogger(ObjectEnvelope.class);
  +
       /**
        * The objects modification state, e.g. Old and Clean
        */
  @@ -90,7 +92,7 @@
           prepareInitialState(isNewObject);
       }
   
  -    PersistenceBroker getBroker()
  +    public PersistenceBroker getBroker()
       {
           return buffer.getTransaction().getBroker();
       }
  @@ -130,6 +132,7 @@
           catch(Exception ex)
           {
               beforeImage = null;
  +            log.error("Can't refresh object image", ex);
               throw new org.odmg.ClassNotPersistenceCapableException(ex.toString());
           }
       }
  @@ -233,8 +236,8 @@
           for(int i = 0; i < fieldDescs.length; i++)
           {
               FieldDescriptor fd = fieldDescs[i];
  -            PersistentField f = fd.getPersistentField();
  -            fieldValues.put(fd.getColumnName(), f.get(myObj));
  +            // map copies of all field values
  +            fieldValues.put(fd.getColumnName(), fd.copyFieldValue(myObj));
           }
           /**
            * MBAIRD
  
  
  

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