You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/07/15 16:09:48 UTC

svn commit: r422225 [1/2] - in /db/ojb/trunk/src: java/org/apache/ojb/broker/ java/org/apache/ojb/broker/accesslayer/ java/org/apache/ojb/broker/accesslayer/conversions/ java/org/apache/ojb/broker/metadata/ java/org/apache/ojb/broker/metadata/fieldacce...

Author: arminw
Date: Sat Jul 15 07:09:47 2006
New Revision: 422225

URL: http://svn.apache.org/viewvc?rev=422225&view=rev
Log:
merge trunk with 1.0.x

Added:
    db/ojb/trunk/src/java/org/apache/ojb/broker/TransientObjectException.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheck.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckDefaultImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckRelaxedImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/conversions/AbstractList2VarcharConversion.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConversionHelper.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldTypes.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypes.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldCGLibImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUIDFactory.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/util/ReaderInputStream.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/util/UnwrapHelper.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerTransientImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/odmg/Image.java
    db/ojb/trunk/src/test/org/apache/ojb/Test_Repository_Renamed_DTD.xml
    db/ojb/trunk/src/test/org/apache/ojb/broker/JdbcJavaObjectTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/UnwrapHelperTest.java
    db/ojb/trunk/src/test/org/apache/ojb/performance/PerfRunner.java

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/TransientObjectException.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/TransientObjectException.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/TransientObjectException.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/TransientObjectException.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,45 @@
+package org.apache.ojb.broker;
+
+/* 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 java.lang.Object;
+
+/**
+ * This exception signals a problem with a transient object.
+ *
+ * @version $Id: $
+ */
+public class TransientObjectException extends OJBException
+{
+    public TransientObjectException()
+    {
+    }
+
+    public TransientObjectException(String msg)
+    {
+        super(msg);
+    }
+
+    public TransientObjectException(Throwable cause)
+    {
+        super(cause);
+    }
+
+    public TransientObjectException(String msg, Throwable cause)
+    {
+        super(msg, cause);
+    }
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheck.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheck.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheck.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheck.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,46 @@
+package org.apache.ojb.broker.accesslayer;
+
+/* Copyright 2002-2006 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 java.io.Serializable;
+
+import org.apache.ojb.broker.metadata.FieldDescriptor;
+
+/**
+ * Declares the protocol for checking if a persistent field's value
+ * represents a 'null' value.
+ * <p>
+ * Used (among other things) for:
+ *  <ul>
+ *   <li>determining if auto-numbering should grab a new sequence id
+ *   <li>checking if a DELETE operation is allowed (all PK-fields must not be null)
+ *   <li>checking if identity handling has enough data (all PK-fields must not be null)
+ *  </ul>
+ * 
+ * @version $Id: NullCheck.java 411859 2006-06-05 17:04:13Z mkalen $
+ * @since OJB 1.0.5
+ */
+public interface NullCheck extends Serializable {
+
+    /**
+     * Returns wether the given object value represents 'null' for the specified field.
+     * @param fld descriptor representation of the persistent field
+     * @param aValue the value to check if it represents 'null' 
+     * @return true if and only if aValue represents null
+     */
+	boolean representsNull(FieldDescriptor fld, Object aValue);
+
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckDefaultImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckDefaultImpl.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckDefaultImpl.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckDefaultImpl.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,75 @@
+package org.apache.ojb.broker.accesslayer;
+
+import org.apache.ojb.broker.metadata.FieldDescriptor;
+
+/* Copyright 2002-2006 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.
+*/
+
+/**
+ * Default implementation of NullCheck.
+ * 
+ * @version $Id: NullCheckDefaultImpl.java 411859 2006-06-05 17:04:13Z mkalen $
+ * @since OJB 1.0.5
+ * @see org.apache.ojb.broker.accesslayer.NullCheckRelaxedImpl
+ */
+public class NullCheckDefaultImpl implements NullCheck
+{
+
+	private static final long serialVersionUID = -3434296237352411888L;
+
+	/**
+     * Returns wether the given object value represents 'null' for the specified field.
+     * <p>
+     * Null is defined as:
+     *  <ul>
+     *   <li>given value is 'null' itself
+     *   <li>given value is instance of Number with value 0 and the field-descriptor
+     *			represents a primitive field
+     *   <li>given value is instance of String with length 0 and the field-descriptor
+     * 			is a primary key
+     *  </ul>
+     * @param fld descriptor representation of the persistent field
+     * @param aValue the value to check if it represents 'null' 
+     * @return true if and only if aValue represents null
+     */
+	public boolean representsNull(FieldDescriptor fld, Object aValue)
+	{
+        if (aValue == null) return true;
+
+        boolean result = false;
+        if (((aValue instanceof Number) && (((Number) aValue).longValue() == 0)))
+        {
+            Class type = fld.getPersistentField().getType();
+            /*
+            AnonymousPersistentFields will *always* have a null type according to the
+            javadoc comments in AnonymousPersistentField.getType() and never represents
+            a primitve java field with value 0, thus we return always 'false' in this case.
+            (If the value object is null, the first check above return true)
+            */
+            if(type != null)
+            {
+                result = type.isPrimitive();
+            }
+        }
+        // TODO: Do we need this check?? String could be nullified, why should we assume
+        // it's 'null' on empty string?
+        else if ((aValue instanceof String) && (((String) aValue).length() == 0))
+        {
+            result = fld.isPrimaryKey();
+        }
+        return result;
+	}
+
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckRelaxedImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckRelaxedImpl.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckRelaxedImpl.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/NullCheckRelaxedImpl.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,47 @@
+package org.apache.ojb.broker.accesslayer;
+
+import org.apache.ojb.broker.metadata.FieldDescriptor;
+
+/* Copyright 2002-2006 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.
+*/
+
+/**
+ * Implementation of NullCheck with a more relaxed definition of 'null' than
+ * {@link NullCheckDefaultImpl]}.
+ * 
+ * @version $Id: NullCheckRelaxedImpl.java 411859 2006-06-05 17:04:13Z mkalen $
+ * @since OJB 1.0.5
+ */
+public class NullCheckRelaxedImpl implements NullCheck
+{
+
+	private static final long serialVersionUID = -2006686663775435151L;
+
+	/**
+     * Returns wether the given object value represents 'null' for the specified field.
+     * <p>
+     * Null is defined as:
+     *  <ul>
+     *   <li>given value is 'null' itself
+     *  </ul>
+     * @param fld descriptor representation of the persistent field
+     * @param aValue the value to check if it represents 'null' 
+     * @return true if and only if aValue represents null
+     */
+	public boolean representsNull(FieldDescriptor fld, Object aValue) {
+		return aValue == null;
+	}
+
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/conversions/AbstractList2VarcharConversion.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/conversions/AbstractList2VarcharConversion.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/conversions/AbstractList2VarcharConversion.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/conversions/AbstractList2VarcharConversion.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,191 @@
+package org.apache.ojb.broker.accesslayer.conversions;
+
+/* Copyright 2002-2006 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 java.lang.Object;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Base class to implement simple object List (e.g. list of strings or list of time values)
+ * to Varchar column conversions.
+ * <br/>
+ * Strings may not contain <em>"#"</em> (at the beginning and end of a string) as this is
+ * used as separator.
+ * Additionally this implementation use keywords for "blank string" and 'null' list entires,
+ * thus string based list entries may not contain keywords <em>"+.EmPtY.+"</em> and <em>"+.NuLl.+"</em>.
+ *
+ * @version $Id: $
+ */
+abstract class AbstractList2VarcharConversion implements FieldConversion
+{
+
+    protected static final String NULLVALUE = "#NULL#";
+    // don't fix the typo! otherwise we are no longer backward compatible
+    protected static final String EMPTYCOLLEC = "#EMTPY#";
+    protected static final String EMPTY_STR_ENTRY = "+.EmPtY.+";
+    protected static final String NULL_ENTRY = "+.NuLl.+";
+
+    public AbstractList2VarcharConversion()
+    {
+    }
+
+    /**
+     * Return a new instance of used {@link java.util.List} implementation.
+     */
+    protected List newList()
+    {
+        return new ArrayList();
+    }
+
+    /**
+     * Converts the list entry to a {@link String} representation. By default
+     * this method simply call 'toString' on specified entry. If entry is 'null'
+     * method returns 'null'.
+     */
+    protected String convertListEntryToString(Object entry)
+    {
+        String result = entry != null ? entry.toString() : null;
+        // if the separator keyword '#' is used within a string
+        // replace it by '##' to allow handle of '#' in strings
+        if(result != null)
+        {
+            result = StringUtils.replace(result, "#", "##");
+        }
+        return result;
+    }
+
+    /**
+     * Add a list entry (extracted from the datastore varchar column) to result list.
+     * By default this method simply add the string to the result list.
+     */
+    protected void addEntryToList(List resultList, String strEntry)
+    {
+        resultList.add(checkResult(strEntry));
+    }
+
+    /**
+     * Check method for String based list entries.
+     */
+    protected String checkResult(String result)
+    {
+        //System.out.println("check: " + result);
+        if(result.equals(NULL_ENTRY))
+        {
+            return null;
+}
+        else if(result.equals(EMPTY_STR_ENTRY))
+        {
+            return "";
+        }
+        else
+        {
+            return result;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ojb.broker.accesslayer.conversions.FieldConversion#javaToSql(java.lang.Object)
+     */
+    public Object javaToSql(Object source) throws ConversionException
+    {
+
+        if (source == null)
+        {
+            return NULLVALUE;
+        }
+
+        try
+        {
+            List sourceList = (List) source;
+            if (sourceList.isEmpty())
+            {
+                return EMPTYCOLLEC;
+            }
+
+            StringBuffer result = new StringBuffer();
+            for (int i = 0; i < sourceList.size(); i++)
+            {
+                String newSt = convertListEntryToString(sourceList.get(i));
+                if (i > 0)
+                {
+                    result.append("#");
+                }
+                if(newSt == null) result.append(NULL_ENTRY);
+                else if(newSt.equals("")) result.append(EMPTY_STR_ENTRY);
+                else result.append(newSt);
+            }
+            return result.toString();
+        }
+        catch (ClassCastException e)
+        {
+            throw new ConversionException("Object is not a List of objects, class: "
+                    + source.getClass().getName());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ojb.broker.accesslayer.conversions.FieldConversion#sqlToJava(java.lang.Object)
+     */
+    public Object sqlToJava(Object source) throws ConversionException
+    {
+        if (source == null)
+        {
+            return null;
+        }
+        if (source.toString().equals(NULLVALUE))
+        {
+            return null;
+        }
+        if (source.toString().equals(EMPTYCOLLEC))
+        {
+            return newList();
+        }
+
+        List resultList = newList();
+        int pos = 0;
+        int length;
+        StringBuffer input = new StringBuffer();
+        StringBuffer newString = new StringBuffer();
+        input.append(source.toString());
+        length = input.length();
+        while (pos < length)
+        {
+            if (input.charAt(pos) != '#')
+            {
+                newString.append(input.charAt(pos));
+            }
+            else
+            {
+                if (input.charAt(pos + 1) != '#')
+                {
+                    addEntryToList(resultList, newString.toString());
+                    newString = new StringBuffer();
+                }
+                else
+                {
+                    newString.append('#');
+                    ++pos;
+                }
+            }
+            ++pos;
+        }
+        addEntryToList(resultList, newString.toString());
+        return resultList;
+    }
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConversionHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConversionHelper.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConversionHelper.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConversionHelper.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,260 @@
+package org.apache.ojb.broker.metadata;
+
+/* Copyright 2002-2006 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 java.sql.Types;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Calendar;
+
+import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
+import org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion;
+import org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion;
+import org.apache.ojb.broker.accesslayer.conversions.Calendar2TimestampFieldConversion;
+import org.apache.ojb.broker.accesslayer.conversions.Calendar2DateFieldConversion;
+import org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion;
+import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
+
+/**
+ * This class manage predefined
+ * {@link org.apache.ojb.broker.accesslayer.conversions.FieldConversion}
+ * for mapped fields (sql-type/java-type) of persistence capable object classes.
+ * <p/>
+ * Use method {@link #addConversionRule(org.apache.ojb.broker.metadata.ConversionHelper.Rule)}
+ * to add more rules (this have to be done before OJB read in mapping information).
+ * <br/>
+ * Method {@link #getAllRules()} returns a list of all
+ * active {@link org.apache.ojb.broker.metadata.ConversionHelper.Rule}.
+ *
+ * @version $Id: $
+ */
+public class ConversionHelper
+{
+    private Map rules = Collections.synchronizedMap(new HashMap());
+
+    public ConversionHelper()
+    {
+        init();
+    }
+
+    private void init()
+    {
+        addConversionRule(new Date2SqlDateRule());
+        addConversionRule(new Date2TimestampRule());
+        addConversionRule(new Calendar2DateRule());
+        addConversionRule(new Calendar2TimestampRule());
+        addConversionRule(new Boolean2IntegerRule());
+    }
+
+    public FieldConversion getConversion(JdbcType jdbc, PersistentField field)
+    {
+        FieldConversion result = null;
+        List sqlTypeRules = (List) rules.get(new Integer(jdbc.getType()));
+        if(sqlTypeRules != null && sqlTypeRules.size() > 0)
+        {
+            for(int i = 0; i < sqlTypeRules.size(); i++)
+            {
+                Rule rule = (Rule) sqlTypeRules.get(i);
+                if(rule.match(jdbc, field))
+                {
+                    result = rule.newConversion();
+                    break;
+                }
+            }
+        }
+        return result;
+    }
+
+    public synchronized void addConversionRule(Rule rule)
+    {
+        Integer key = new Integer(rule.getSqlType());
+        List ruleList = (List) rules.get(key);
+        if(ruleList == null)
+        {
+            ruleList = new ArrayList();
+            rules.put(key, ruleList);
+        }
+        ruleList.add(rule);
+    }
+
+    public synchronized boolean removeConversionRule(Rule rule)
+    {
+        boolean result = false;
+        List ruleList = (List) rules.get(new Integer(rule.getSqlType()));
+        if(ruleList != null)
+        {
+            result = ruleList.remove(rule);
+        }
+        return result;
+    }
+
+    public List getAllRules()
+    {
+        List result = new ArrayList();
+        Collection rulesList = rules.values();
+        for(Iterator iterator = rulesList.iterator(); iterator.hasNext();)
+        {
+            List list = (List) iterator.next();
+            result.addAll(list);
+        }
+        return result;
+    }
+
+    /**
+     * Defines a rule for a specific java-field/sql type combination, e.g.
+     * if java-field is of type {@link java.util.Date} and sql-type is DATE, then the
+     * rule (see {@link org.apache.ojb.broker.metadata.ConversionHelper.Rule#newConversion()})
+     * should return a {@link org.apache.ojb.broker.accesslayer.conversions.FieldConversion}
+     * handle {@link java.util.Date} to {@link java.sql.Date}
+     * conversion.
+     */
+    public static interface Rule
+    {
+        /** Returns the sql-type {see @link java.sql.Types} matched by this rule. */
+        int getSqlType();
+
+        /**
+         * Returns <em>true</em> if the specified {@link JdbcType} and {@link FieldType}
+         * match the rule.
+         *
+         * @param jdbc The {@link JdbcType} of the database column.
+         * @param field The {@link FieldType} of the mapped persistent object field.
+         * @return If match <em>true</em> is returned.
+         */
+        boolean match(JdbcType jdbc, PersistentField field);
+
+        /**
+         * Returns a new instance of the
+         * {@link org.apache.ojb.broker.accesslayer.conversions.FieldConversion}
+         * matched by this rule.
+         */
+        FieldConversion newConversion();
+    }
+
+    static class Date2SqlDateRule implements Rule
+    {
+        public int getSqlType()
+        {
+            return Types.DATE;
+        }
+
+        public boolean match(JdbcType jdbc, PersistentField field)
+        {
+            boolean result = false;
+            if(jdbc.getType() == getSqlType())
+            {
+                Class fieldClass = field.getType();
+                if(Date.class.isAssignableFrom(fieldClass))
+                {
+                    result = true;
+                }
+            }
+            return result;
+        }
+
+        public FieldConversion newConversion()
+        {
+            return new JavaDate2SqlDateFieldConversion();
+        }
+    }
+
+    static class Date2TimestampRule extends Date2SqlDateRule
+    {
+        public int getSqlType()
+        {
+            return Types.TIMESTAMP;
+        }
+
+        public FieldConversion newConversion()
+        {
+            return new JavaDate2SqlTimestampFieldConversion();
+        }
+    }
+
+    static class Calendar2DateRule implements Rule
+    {
+        public int getSqlType()
+        {
+            return Types.DATE;
+        }
+
+        public boolean match(JdbcType jdbc, PersistentField field)
+        {
+            boolean result = false;
+            if(jdbc.getType() == getSqlType())
+            {
+                Class fieldClass = field.getType();
+                if(Calendar.class.isAssignableFrom(fieldClass))
+                {
+                    result = true;
+                }
+            }
+            return result;
+        }
+
+        public FieldConversion newConversion()
+        {
+            return new Calendar2DateFieldConversion();
+        }
+    }
+
+    static class Calendar2TimestampRule extends Calendar2DateRule
+    {
+        public int getSqlType()
+        {
+            return Types.TIMESTAMP;
+        }
+
+        public FieldConversion newConversion()
+        {
+            return new Calendar2TimestampFieldConversion();
+        }
+    }
+
+    static class Boolean2IntegerRule implements Rule
+    {
+        public int getSqlType()
+        {
+            return Types.INTEGER;
+        }
+
+        public boolean match(JdbcType jdbc, PersistentField field)
+        {
+            boolean result = false;
+            if(jdbc.getType() == getSqlType())
+            {
+                Class fieldClass = field.getType();
+                if(FieldTypes.BooleanFieldType.class.isAssignableFrom(jdbc.getFieldType().getClass())
+                        || Boolean.class.isAssignableFrom(fieldClass))
+                {
+                    result = true;
+                }
+            }
+            return result;
+        }
+
+        public FieldConversion newConversion()
+        {
+            return new Boolean2IntFieldConversion();
+        }
+    }
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldTypes.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldTypes.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldTypes.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldTypes.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,442 @@
+package org.apache.ojb.broker.metadata;
+
+/* Copyright 2002-2006 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 java.io.Serializable;
+import java.lang.reflect.Method;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.ojb.broker.util.logging.LoggerFactory;
+import org.apache.ojb.broker.OJBRuntimeException;
+import org.apache.ojb.broker.lob.LobHandle;
+
+/**
+ * Encapsulates {@link org.apache.ojb.broker.metadata.FieldType} implementations as inner classes.
+ *
+ * @version $Id: FieldTypes.java 365232 2005-12-21 23:36:07 +0100 (Mi, 21 Dez 2005) tomdz $
+ */
+public class FieldTypes
+{
+    private FieldTypes()
+    {
+    }
+
+    /** Base class for all fields. */
+    abstract static class BaseFieldType implements FieldType
+    {
+        /**
+         * Helper method to copy an object if possible.
+         *
+         * @param toCopy The object to copy.
+         * @return The copy of the object or <em>null</em> clone is not supported.
+         */
+        private Object copyIfCloneable(Object toCopy)
+        {
+            Object result = null;
+            if(toCopy instanceof Cloneable)
+            {
+                try
+                {
+                    Method m = toCopy.getClass().getMethod("clone", ArrayUtils.EMPTY_CLASS_ARRAY);
+                    /*
+                    arminw:
+                    By definition the overrided object.clone() method has to be public
+                    so we don't need to make it accessible
+                    */
+                    //m.setAccessible(true);
+                    result = m.invoke(toCopy, null);
+                }
+                catch(Exception e)
+                {
+                    LoggerFactory.getDefaultLogger().error("[" + this.getClass().getName() + "]"
+                            + "Can't invoke method 'clone' on Cloneable object: " + toCopy, e);
+                }
+            }
+            return result;
+        }
+
+        /**
+         * Helper method to copy an object if possible.
+         *
+         * @param toCopy The object to copy.
+         * @return The copy of the object or <em>null</em> if serialization is not supported.
+         */
+        private Object copyIfSerializeable(Object toCopy)
+        {
+            Object result = null;
+            if(toCopy instanceof Serializable)
+            {
+                result = SerializationUtils.clone((Serializable) toCopy);
+            }
+            return result;
+        }
+
+        /**
+         * This method copy the specified object if the object
+         * is {@link Cloneable} or {@link java.io.Serializable}, else
+         * <code>NULL</code> is returned.
+         *
+         * @param toCopy The object to copy.
+         * @return The copy result.
+         */
+        Object copyIfPossible(Object toCopy)
+        {
+            Object copy = copyIfCloneable(toCopy);
+            if(copy == null)
+            {
+                copy = copyIfSerializeable(toCopy);
+            }
+            return copy;
+        }
+
+        public String toString()
+        {
+            return new ToStringBuilder(this)
+                    .append("isMutable", isMutable()).toString();
+        }
+
+        public boolean isLobField()
+        {
+            return false;
+        }
+    }
+
+    /** Base class for all <em>immutable</em> types, like Number fields, Strings, ... */
+    abstract static class ImmutableFieldType extends BaseFieldType
+    {
+        public boolean isMutable()
+        {
+            return false;
+        }
+
+        public Object copy(Object source)
+        {
+            return source;
+        }
+
+        public boolean equals(Object firstValue, Object secondValue)
+        {
+            return ObjectUtils.equals(firstValue, secondValue);
+        }
+    }
+
+    /** Base class for all <em>mutable</em> fields. */
+    abstract static class MutableFieldType extends BaseFieldType
+    {
+        public boolean isMutable()
+        {
+            return true;
+        }
+
+        public boolean equals(Object firstValue, Object secondValue)
+        {
+            return ObjectUtils.equals(firstValue, secondValue);
+        }
+    }
+
+    /**
+     * Base class for LOB fields implemented as mutable field.
+     */
+    static class LobFieldType extends MutableFieldType
+    {
+        public boolean isLobField()
+        {
+            return true;
+        }
+
+        /**
+         * It's not possible to copy locator objects, thus this method always
+         * returns a decoupled LOB wrapper object.
+         *
+         * @param fieldValue The value to copy.
+         * @return A decoupled locator instance.
+         */
+        public Object copy(Object fieldValue)
+        {
+            if(fieldValue != null)
+            {
+                LobHandle lob = (LobHandle) fieldValue;
+                return lob.decoupledCopy();
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        /**
+         * Compare locator objects is different from "normal fields", because the locator object
+         * itself can't be compared. Thus we expect that the locator is of
+         * type {@link org.apache.ojb.broker.lob.LobHandle}.
+         *
+         * @param firstValue First value to compare.
+         * @param secondValue Second value to compare.
+         * @return The comparision state of both fields.
+         */
+        public boolean equals(Object firstValue, Object secondValue)
+        {
+            LobHandle first = (LobHandle) firstValue;
+            LobHandle second = (LobHandle) secondValue;
+            boolean result = true;
+            if(first != null)
+            {
+                // one was nullified
+                if(second == null)
+                {
+                    result = false;
+                }
+                // both are not null, check internal state
+                else
+                {
+                    result = !first.isDirty() || !second.isDirty();
+                }
+            }
+            else
+            {
+                // second isn't null
+                if(second != null)
+                {
+                    result = false;
+                }
+                // else both are null
+            }
+            return result;
+        }
+    }
+
+    /**
+     * Clob (like other LOB's) fields normally are logical pointer to DB
+     * thus it's mutable, because the LOB content could change.
+     *
+     * @see BlobFieldType
+     */
+    public static class ClobFieldType extends LobFieldType
+    {
+    }
+
+    /**
+     * Blob (like other LOB's) fields normally are logical pointer to DB
+     * thus it's mutable, because the LOB content could change.
+     * Snip of JDBC specification:
+     * "An application does not deal directly with the LOCATOR(blob) and
+     * LOCATOR(clob) types that are defined in SQL. By default, a JDBC
+     * driver should implement the Blob and Clob interfaces using the
+     * appropriate locator type. Also by default, Blob and Clob objects
+     * remain valid only during the transaction in which they are created."
+     */
+    public static class BlobFieldType extends LobFieldType
+    {
+    }
+
+    /**
+     * Array fields are logical pointer to DB, so for OJB it's immutable.
+     * Snip of JDBC specification:
+     * "The Array object returned to an application by the ResultSet.getArray and
+     * CallableStatement.getArray methods is a logical pointer to the SQL ARRAY
+     * value in the database; it does not contain the contents of the SQL ARRAY value."
+     */
+    public static class ArrayFieldType extends ImmutableFieldType
+    {
+    }
+
+    /**
+     * Ref fields are logical pointer to DB, so for OJB it's immutable.
+     * Snip of JDBC specification:
+     * "An SQL REF value is a pointer; therefore, a Ref object, which is the mapping of a
+     * REF value, is likewise a pointer and does not contain the data of the structured type
+     * instance to which it refers."
+     */
+    public static class RefFieldType extends ImmutableFieldType
+    {
+    }
+
+    /**
+     * When using SQL UDT's it's possible that the jdbc-driver returns
+     * full materialized java objects defined by the user.
+     */
+    public static class StructFieldType extends MutableFieldType
+    {
+        // TODO: does this make sense?? or Struct instances always Locator objects?
+        public Object copy(Object fieldValue)
+        {
+            if(fieldValue == null) return null;
+
+            Object copy = copyIfPossible(fieldValue);
+            return copy == null ? fieldValue : copy;
+        }
+    }
+
+    /**
+     * If a user-defined object is used, we can check if object is
+     * {@link Cloneable} or {@link java.io.Serializable} to copy the object.
+     * If not possible return the specified object instance.
+     */
+    public static class JavaObjectFieldType extends MutableFieldType
+    {
+        public Object copy(Object fieldValue)
+        {
+            if(fieldValue == null) return null;
+
+            Object copy = copyIfPossible(fieldValue);
+            return copy == null ? fieldValue : copy;
+        }
+    }
+
+    public static class ByteArrayFieldType extends MutableFieldType
+    {
+        public Object copy(Object fieldValue)
+        {
+            byte[] result = null;
+            if(fieldValue != null)
+            {
+                byte[] source = (byte[]) fieldValue;
+                int length = source.length;
+                result = new byte[length];
+                System.arraycopy(fieldValue, 0, result, 0, length);
+            }
+            return result;
+        }
+
+        public boolean equals(Object firstValue, Object secondValue)
+        {
+            return Arrays.equals((byte[]) firstValue, (byte[]) secondValue);
+        }
+    }
+
+    public static class DateFieldType extends MutableFieldType
+    {
+        public Object copy(Object fieldValue)
+        {
+            Date source = (Date) fieldValue;
+            return source != null ? new Date(source.getTime()) : null;
+        }
+    }
+
+    public static class TimeFieldType extends MutableFieldType
+    {
+        public Object copy(Object fieldValue)
+        {
+            Time source = (Time) fieldValue;
+            return source != null ? new Time(source.getTime()) : null;
+        }
+    }
+
+    public static class TimestampFieldType extends MutableFieldType
+    {
+        public Object copy(Object fieldValue)
+        {
+            Timestamp result = null;
+            if(fieldValue != null)
+            {
+                Timestamp source = (Timestamp) fieldValue;
+                result = (Timestamp) source.clone();
+            }
+            return result;
+        }
+    }
+
+    public static class URLFieldType extends MutableFieldType
+    {
+        public Object copy(Object fieldValue)
+        {
+            URL url = (URL) fieldValue;
+            try
+            {
+                return new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile());
+            }
+            catch(MalformedURLException e)
+            {
+                throw new CopyException("Can't copy URL: " + fieldValue);
+            }
+        }
+    }
+
+    public static class StringFieldType extends ImmutableFieldType
+    {
+    }
+
+    public static class BigDecimalFieldType extends ImmutableFieldType
+    {
+    }
+
+    public static class BooleanFieldType extends ImmutableFieldType
+    {
+    }
+
+    public static class ByteFieldType extends ImmutableFieldType
+    {
+    }
+
+    public static class ShortFieldType extends ImmutableFieldType
+    {
+
+    }
+
+    public static class IntegerFieldType extends ImmutableFieldType
+    {
+
+    }
+
+    public static class LongFieldType extends ImmutableFieldType
+    {
+
+    }
+
+    public static class FloatFieldType extends ImmutableFieldType
+    {
+
+    }
+
+    public static class DoubleFieldType extends ImmutableFieldType
+    {
+
+    }
+
+    /**
+     * A <em>CopyException</em> is thrown when an unexpected field copy error occur.
+     */
+    public static class CopyException extends OJBRuntimeException
+    {
+        public CopyException()
+        {
+            super();
+        }
+
+        public CopyException(String msg)
+        {
+            super(msg);
+        }
+
+        public CopyException(Throwable cause)
+        {
+            super(cause);
+        }
+
+        public CopyException(String msg, Throwable cause)
+        {
+            super(msg, cause);
+        }
+    }
+}

Added: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypes.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypes.java?rev=422225&view=auto
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypes.java (added)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypes.java Sat Jul 15 07:09:47 2006
@@ -0,0 +1,1352 @@
+package org.apache.ojb.broker.metadata;
+
+/* Copyright 2002-2006 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 java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+
+import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.ojb.broker.util.SqlHelper;
+import org.apache.ojb.broker.util.sequence.SequenceManagerException;
+
+/**
+ * Encapsulates {@link org.apache.ojb.broker.metadata.JdbcType} implementations as inner classes.
+ *
+ * @version $Id: JdbcTypes.java 382468 2006-03-02 20:00:37 +0100 (Do, 02 Mrz 2006) arminw $
+ * @see JdbcType
+ */
+public class JdbcTypes
+{
+    private JdbcTypes()
+    {
+        // default constructor
+    }
+
+    //======================================================================================
+    // inner classes implementing JdbcType interface
+    //======================================================================================
+
+    public abstract static class BaseType implements JdbcType
+    {
+        private FieldType fieldType;
+
+        protected BaseType()
+        {
+            fieldType = lookupFieldType();
+        }
+
+        /**
+         * This method is responsible to associate the {@link FieldType}
+         * of this {@link JdbcType}.
+         */
+        FieldType lookupFieldType()
+        {
+            return JdbcTypesHelper.newFieldType(this);
+        }
+
+        /**
+         * Abstract method to read in query results.
+         *
+         * @param rs The current active result set.
+         * @param columnName The column name of row to read.
+         * @return The value of the row (could be <em>null</em>).
+         * @throws SQLException
+         */
+        abstract Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException;
+
+        /**
+         * Abstract method to read in query results.
+         *
+         * @param rs The current active result set.
+         * @param columnIndex The column index of row to read.
+         * @return The value of the row (could be <em>null</em>).
+         * @throws SQLException
+         */
+        abstract Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException;
+
+        /**
+         * Abstract method to read in query results.
+         *
+         * @param stmt The current active callable statement.
+         * @param columnIndex The column index of row to read.
+         * @return The value of the row (could be <em>null</em>).
+         * @throws SQLException
+         */
+        abstract Object readValueFromStatement(final CallableStatement stmt, final 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 FieldType getFieldType()
+        {
+            return fieldType;
+        }
+
+        public Object getObjectFromColumn(final CallableStatement stmt, final int columnId) throws SQLException
+        {
+            return getObjectFromColumn(null, stmt, null, columnId);
+        }
+
+        public Object getObjectFromColumn(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return getObjectFromColumn(rs, null, columnName, MIN_INT);
+        }
+
+        public Object getObjectFromColumn(final ResultSet rs, final int columnId) throws SQLException
+        {
+            return getObjectFromColumn(rs, null, null, columnId);
+        }
+
+        public Object getObjectFromColumn(final ResultSet rs, final CallableStatement stmt,
+                                          final String columnName, final int columnIndex) throws SQLException
+        {
+            if(stmt != null)
+            {
+                if(columnIndex == MIN_INT)
+                {
+                    throw new UnsupportedOperationException("Not implemented yet");
+                }
+                else
+                {
+                    return readValueFromStatement(stmt, columnIndex);
+                }
+            }
+            else
+            {
+                return columnIndex == MIN_INT ?
+                        readValueFromResultSet(rs, SqlHelper.stripOjbQuotes(columnName))
+                        : readValueFromResultSet(rs, columnIndex);
+            }
+        }
+
+        public String toString()
+        {
+            return new ToStringBuilder(this)
+                    .append("jdbcType", getType())
+                    .append("jdbcTypeString", JdbcTypesHelper.getSqlTypeAsString(getType()))
+                    .append("associatedFieldType", getFieldType())
+                    .toString();
+        }
+
+//      // 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		public Object sequenceKeyConversion(Long identifier)
+        {
+            return identifier.toString();
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getString(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getString(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getString(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getString(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.CHAR;
+        }
+    }
+
+    public static final class T_Varchar extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		public Object sequenceKeyConversion(Long identifier)
+        {
+            return identifier.toString();
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getString(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getString(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getString(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getString(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.VARCHAR;
+        }
+    }
+
+    public static final class T_LongVarChar extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		public Object sequenceKeyConversion(Long identifier)
+        {
+            return identifier.toString();
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getString(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getString(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getString(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getString(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.LONGVARCHAR;
+        }
+    }
+
+    public static final class T_Numeric extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return BigDecimal.valueOf(identifier.longValue());
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getBigDecimal(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getBigDecimal(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getBigDecimal(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getBigDecimal(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.NUMERIC;
+        }
+    }
+
+    public static final class T_Decimal extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		public Object sequenceKeyConversion(Long identifier)
+        {
+        	return BigDecimal.valueOf(identifier.longValue());
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getBigDecimal(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getBigDecimal(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getBigDecimal(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getBigDecimal(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.DECIMAL;
+        }
+    }
+
+    public static final class T_Bit extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            boolean temp = stmt.getBoolean(columnIndex);
+            return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            boolean temp = rs.getBoolean(columnName);
+            return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            boolean temp = stmt.getBoolean(columnIndex);
+            return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            boolean temp = rs.getBoolean(columnName);
+            return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+		public Object sequenceKeyConversion(final Long identifier)
+        {
+            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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            byte temp = stmt.getByte(columnIndex);
+            return (stmt.wasNull() ? null : new Byte(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            byte temp = rs.getByte(columnName);
+            return (rs.wasNull() ? null : new Byte(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            short temp = stmt.getShort(columnIndex);
+            return (stmt.wasNull() ? null : new Short(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            short temp = rs.getShort(columnName);
+            return (rs.wasNull() ? null : new Short(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            int temp = stmt.getInt(columnIndex);
+            return (stmt.wasNull() ? null : new Integer(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            int temp = rs.getInt(columnName);
+            return (rs.wasNull() ? null : new Integer(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return identifier;
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            long temp = stmt.getLong(columnName);
+//            return (stmt.wasNull() ? null : new Long(temp));
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            long temp = stmt.getLong(columnIndex);
+            return (stmt.wasNull() ? null : new Long(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            long temp = rs.getLong(columnName);
+            return (rs.wasNull() ? null : new Long(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            float temp = stmt.getFloat(columnIndex);
+            return (stmt.wasNull() ? null : new Float(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            float temp = rs.getFloat(columnName);
+            return (rs.wasNull() ? null : new Float(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            double temp = stmt.getDouble(columnIndex);
+            return (stmt.wasNull() ? null : new Double(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            double temp = rs.getDouble(columnName);
+            return (rs.wasNull() ? null : new Double(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            double temp = stmt.getDouble(columnIndex);
+            return (stmt.wasNull() ? null : new Double(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            double temp = rs.getDouble(columnName);
+            return (rs.wasNull() ? null : new Double(temp));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return identifier.toString().getBytes();
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getBytes(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getBytes(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getBytes(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getBytes(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.BINARY;
+        }
+    }
+
+    public static final class T_VarBinary extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return identifier.toString().getBytes();
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getBytes(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getBytes(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getBytes(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getBytes(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.VARBINARY;
+        }
+    }
+
+    public static final class T_LongVarBinary extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+        private 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 java.sql.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[JdbcTypes.T_LongVarBinary.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)
+        {
+            return identifier.toString().getBytes();
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getBytes(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getBytes(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return JdbcTypes.T_LongVarBinary.retrieveStreamDataFromRs(rs.getBinaryStream(columnName));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return JdbcTypes.T_LongVarBinary.retrieveStreamDataFromRs(rs.getBinaryStream(columnIndex));
+        }
+
+        public int getType()
+        {
+            return Types.LONGVARBINARY;
+        }
+    }
+
+    public static final class T_Date extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return new Date(identifier.longValue());
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getDate(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getDate(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getDate(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getDate(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.DATE;
+        }
+    }
+
+    public static final class T_Time extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return new Time(identifier.longValue());
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getTime(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getTime(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getTime(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getTime(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.TIME;
+        }
+    }
+
+    public static final class T_Timestamp extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier)
+        {
+            return new Timestamp(identifier.longValue());
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getTimestamp(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getTimestamp(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getTimestamp(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getTimestamp(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.TIMESTAMP;
+        }
+    }
+
+    public static final class T_Clob extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+
+        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            Clob aClob = stmt.getClob(columnIndex);
+            return stmt.wasNull() ? null : aClob;
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            Clob aClob = rs.getClob(columnName);
+            return rs.wasNull() ? null : aClob;
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            Clob aClob = rs.getClob(columnIndex);
+            return rs.wasNull() ? null : aClob;
+        }
+
+        public int getType()
+        {
+            return Types.CLOB;
+        }
+    }
+
+    public static final class T_ClobToString extends JdbcTypes.BaseType
+    {
+		private static final long serialVersionUID = 1L;
+        private 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 java.sql.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[JdbcTypes.T_ClobToString.BUFSZ];
+            java.io.Reader stream = aClob.getCharacterStream();
+            try
+            {
+                int numRead;
+                while((numRead = stream.read(buf)) != -1)
+                {
+                    sb.append(buf, 0, numRead);
+                }
+                stream.close();
+            }
+            catch(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'");
+        }
+
+        FieldType lookupFieldType()
+        {
+            return new FieldTypes.StringFieldType();
+        }
+
+//        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            Clob aClob = stmt.getClob(columnIndex);
+            return (stmt.wasNull() ? null : JdbcTypes.T_ClobToString.safeClobToString(aClob));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            Clob aClob = rs.getClob(columnName);
+            return (rs.wasNull() ? null : JdbcTypes.T_ClobToString.safeClobToString(aClob));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            Clob aClob = rs.getClob(columnIndex);
+            return (rs.wasNull() ? null : JdbcTypes.T_ClobToString.safeClobToString(aClob));
+        }
+
+        public int getType()
+        {
+            return Types.CLOB;
+        }
+    }
+
+    public static final class T_Blob extends JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            Blob aBlob = stmt.getBlob(columnIndex);
+            return stmt.wasNull() ? null : aBlob;
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            Blob aBlob = rs.getBlob(columnName);
+            return rs.wasNull() ? null : aBlob;
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            Blob aBlob = rs.getBlob(columnIndex);
+            return rs.wasNull() ? null : aBlob;
+        }
+
+        public int getType()
+        {
+            return Types.BLOB;
+        }
+    }
+
+    public static final class T_BlobToByteArray extends JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
+        {
+            throw new SequenceManagerException("Not supported sequence key type 'BLOB'");
+        }
+
+        FieldType lookupFieldType()
+        {
+            return new FieldTypes.ByteArrayFieldType();
+        }
+
+//        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            Blob aBlob = stmt.getBlob(columnIndex);
+            return (stmt.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            Blob aBlob = rs.getBlob(columnName);
+            return (rs.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final 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 JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getArray(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getArray(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getArray(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.ARRAY;
+        }
+    }
+
+    public static final class T_Struct extends JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getObject(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getObject(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getObject(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.STRUCT;
+        }
+    }
+
+    public static final class T_Ref extends JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getRef(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getRef(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getRef(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.REF;
+        }
+    }
+
+    public static final class T_JavaObject extends JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
+        {
+            throw new SequenceManagerException("Not supported sequence key type 'JAVA_OBJECT'");
+        }
+
+//        Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
+//        {
+//            return stmt.getRef(columnName);
+//        }
+
+        Object readValueFromStatement(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getObject(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getObject(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getObject(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.JAVA_OBJECT;
+        }
+    }
+
+//#ifdef JDBC30
+
+    public static final class T_Datalink extends JdbcTypes.BaseType
+    {
+    	private static final long serialVersionUID = 1L;
+
+        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(final CallableStatement stmt, final int columnIndex) throws SQLException
+        {
+            return stmt.getURL(columnIndex);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final String columnName) throws SQLException
+        {
+            return rs.getURL(columnName);
+        }
+
+        Object readValueFromResultSet(final ResultSet rs, final int columnIndex) throws SQLException
+        {
+            return rs.getURL(columnIndex);
+        }
+
+        public int getType()
+        {
+            return Types.DATALINK;
+        }
+    }
+//#endif
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org