You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2006/06/15 14:57:57 UTC
svn commit: r414572 - in /db/torque:
runtime/trunk/src/java/org/apache/torque/om/ site/trunk/xdocs/
templates/trunk/src/templates/om/
test/trunk/test-project/src/java/org/apache/torque/om/
test/trunk/test-project/src/schema/
Author: tfischer
Date: Thu Jun 15 05:57:57 2006
New Revision: 414572
URL: http://svn.apache.org/viewvc?rev=414572&view=rev
Log:
Added setByName and setByPosition methods in the generated object classes
that match the already existing getByName and getByPosition methods
Thanks to Greg Monroe for the contribution.
Fixes TORQUE-26.
Added:
db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java
Modified:
db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java
db/torque/site/trunk/xdocs/changes.xml
db/torque/templates/trunk/src/templates/om/Object.vm
db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
db/torque/test/trunk/test-project/src/schema/test-schema.xml
Modified: db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java?rev=414572&r1=414571&r2=414572&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java Thu Jun 15 05:57:57 2006
@@ -163,10 +163,10 @@
/**
* Retrieves a field from the object by name. Must be overridden if called.
* BaseObject's implementation will throw an Error.
- *
+ *
* @param field The name of the field to retrieve.
* @return The retrieved field value
- *
+ *
*/
public Object getByName(String field)
{
@@ -174,10 +174,26 @@
}
/**
- * Retrieves a field from the object by name passed in
- * as a String. Must be overridden if called.
- * BaseObject's implementation will throw an Error.
- *
+ * Set a field in the object by field (Java) name.
+ *
+ * @param name field name
+ * @param value field value
+ * @return True if value was set, false if not (invalid name / protected
+ * field).
+ * @throws IllegalArgumentException if object type of value does not match
+ * field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByName(String name, Object value) throws TorqueException,
+ IllegalArgumentException
+ {
+ throw new Error("BaseObject.setByName: " + NOT_IMPLEMENTED);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a String. Must be
+ * overridden if called. BaseObject's implementation will throw an Error.
+ *
* @param name field name
* @return value of the field
*/
@@ -187,10 +203,27 @@
}
/**
- * Retrieves a field from the object by position as specified
- * in a database schema for example. Must be overridden if called.
- * BaseObject's implementation will throw an Error.
- *
+ * Set field values by Peer Field Name
+ *
+ * @param name field name
+ * @param value field value
+ * @return True if value was set, false if not (invalid name / protected
+ * field).
+ * @throws IllegalArgumentException if object type of value does not match
+ * field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByPeerName(String name, Object value)
+ throws TorqueException, IllegalArgumentException
+ {
+ throw new Error("BaseObject.setByPeerName: " + NOT_IMPLEMENTED);
+ }
+
+ /**
+ * Retrieves a field from the object by position as specified in a database
+ * schema for example. Must be overridden if called. BaseObject's
+ * implementation will throw an Error.
+ *
* @param pos field position
* @return value of the field
*/
@@ -200,12 +233,30 @@
}
/**
- * Compares this with another <code>BaseObject</code> instance. If
- * <code>obj</code> is an instance of <code>BaseObject</code>, delegates to
- * <code>equals(BaseObject)</code>. Otherwise, returns <code>false</code>.
- *
+ * Set field values by it's position (zero based) in the XML schema.
+ *
+ * @param position The field position
+ * @param value field value
+ * @return True if value was set, false if not (invalid position / protected
+ * field).
+ * @throws IllegalArgumentException if object type of value does not match
+ * field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByPosition(int position, Object value)
+ throws TorqueException, IllegalArgumentException
+ {
+ throw new Error("BaseObject.setByPosition: " + NOT_IMPLEMENTED);
+ }
+
+ /**
+ * Compares this with another <code>BaseObject</code> instance. If
+ * <code>obj</code> is an instance of <code>BaseObject</code>,
+ * delegates to <code>equals(BaseObject)</code>. Otherwise, returns
+ * <code>false</code>.
+ *
* @param obj The object to compare to.
- * @return Whether equal to the object specified.
+ * @return Whether equal to the object specified.
*/
public boolean equals(Object obj)
{
Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?rev=414572&r1=414571&r2=414572&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Thu Jun 15 05:57:57 2006
@@ -29,6 +29,10 @@
<release version="3.2.1-dev" date="in SVN">
+ <action type="add" dev="tfischer" issue="TORQUE-26" due-to="Greg Monroe">
+ Added setByName and setByPosition methods in the generated object classes
+ that match the already existing getByName and getByPosition methods.
+ </action>
<action type="fix" dev="tfischer" issue="TORQUE-28" due-to="Mojmir Hanes">
Fixed wrong constant CLASS_DEFAULT_NAME in generated peer classes.
The error occurred only if the option torque.subpackage.object
Modified: db/torque/templates/trunk/src/templates/om/Object.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Object.vm?rev=414572&r1=414571&r2=414572&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Object.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Object.vm Thu Jun 15 05:57:57 2006
@@ -255,7 +255,7 @@
for (int i = 0; i < ${collName}.size(); i++)
{
((${tblFK.JavaName}) ${collName}.get(i))
- .${colFK.SetterName}(v);
+ .${colFK.SetterName}(v);
}
}
#end
@@ -946,7 +946,7 @@
#else
* If this $table.JavaName is new, this method will return
#end
- * an empty collection; or if this $table.JavaName has previously
+ * an empty collection; or if this $table.JavaName has previously
* been saved, it will retrieve related ${relCol} from storage.
*
* This method is protected by default in order to keep the public
@@ -1034,7 +1034,7 @@
}
/**
- * Retrieves a field from the object by name passed in as a String.
+ * Retrieves a field from the object by field (Java) name passed in as a String.
*
* @param name field name
* @return value
@@ -1070,6 +1070,91 @@
}
/**
+ * Set a field in the object by field (Java) name.
+ *
+ * @param name field name
+ * @param value field value
+ * @return True if value was set, false if not (invalid name / protected field).
+ * @throws IllegalArgumentException if object type of value does not match field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByName(String name, Object value )
+ throws TorqueException, IllegalArgumentException
+ {
+ #foreach ($col in $table.Columns)
+ #set ( $cjtype = $col.JavaNative )
+ if (name.equals("${col.JavaName}"))
+ {
+ #if ( ${col.isPrimitive()} )
+ #if ($cjtype == "int")
+ if (value == null || ! (Integer.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
+ }
+ ${col.SetterName}(((Integer) value).intValue());
+ #elseif ($cjtype == "long")
+ if (value == null || ! (Long.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Long object.");
+ }
+ ${col.SetterName}(((Long) value).longValue());
+ #elseif ($cjtype == "float")
+ if (value == null || ! (Float.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Float object.");
+ }
+ ${col.SetterName}(((Float) value).floatValue());
+ #elseif ($cjtype == "double")
+ if (value == null || ! (Double.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Double object.");
+ }
+ ${col.SetterName}(((Double) value).doubleValue());
+ #elseif ($cjtype == "boolean")
+ if (value == null || ! (Boolean.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Boolean object.");
+ }
+ ${col.SetterName}(((Boolean)value).booleanValue());
+ #elseif ($cjtype == "short")
+ if (value == null || ! (Short.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Short object.");
+ }
+ ${col.SetterName}(((Short)value).shortValue());
+ #elseif ($cjtype == "byte")
+ if (value == null || ! (Byte.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Byte object.");
+ }
+ ${col.SetterName}(((Byte) value).byteValue());
+ #elseif ($cjtype == "char")
+ if (value == null || ! (Character.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Character object.");
+ }
+ ${col.SetterName}(((Character) value).charValue());
+ #end
+ #else
+ #if ( ${col.JavaNative} )
+ // Object fields can be null
+ if (value != null && ! ${col.JavaNative}.class.isInstance(value))
+ {
+ throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
+ }
+ ${col.SetterName}(($cjtype) value);
+ #else
+ // Hmm, using column type that can't be mapped to a Java object class, make this obvious.
+ throw IllegalStateException("Can't determine Java Object type for column, ${col.Name}!");
+ #end
+ #end
+ return true;
+ }
+ #end
+ return false;
+ }
+
+ /**
* Retrieves a field from the object by name passed in
* as a String. The String must be one of the static
* Strings defined in this Class' Peer.
@@ -1109,6 +1194,28 @@
}
/**
+ * Set field values by Peer Field Name
+ *
+ * @param name field name
+ * @param value field value
+ * @return True if value was set, false if not (invalid name / protected field).
+ * @throws IllegalArgumentException if object type of value does not match field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByPeerName(String name, Object value)
+ throws TorqueException, IllegalArgumentException
+ {
+ #foreach ($col in $table.Columns)
+ #set ( $cup=$col.Name.toUpperCase() )
+ if (${table.JavaName}Peer.${cup}.equals(name))
+ {
+ return setByName("${col.JavaName}", value);
+ }
+ #end
+ return false;
+ }
+
+ /**
* Retrieves a field from the object by Position as specified
* in the xml schema. Zero-based.
*
@@ -1146,6 +1253,30 @@
#end
return null;
}
+
+ /**
+ * Set field values by its position (zero based) in the XML schema.
+ *
+ * @param position The field position
+ * @param value field value
+ * @return True if value was set, false if not (invalid position / protected field).
+ * @throws IllegalArgumentException if object type of value does not match field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByPosition(int position, Object value)
+ throws TorqueException, IllegalArgumentException
+ {
+ #set ($i = 0)
+ #foreach ($col in $table.Columns)
+ #set ( $cup=$col.Name.toUpperCase() )
+ if (position == $i)
+ {
+ return setByName("${col.JavaName}", value);
+ }
+ #set ( $i = $i + 1)
+ #end
+ return false;
+ }
#end ## ends the if(addGetByNameMethod)
#if (!$table.isAlias() && $addSaveMethod)
@@ -1630,7 +1761,7 @@
return copyInto(copyObj, true);
}
#end
-
+
/**
* Fills the copyObj with the contents of this object.
#if ($complexObjectModel)
Modified: db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm?rev=414572&r1=414571&r2=414572&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm Thu Jun 15 05:57:57 2006
@@ -389,6 +389,16 @@
#else
$varName = ${interfaceName}Manager.getInstance($arglist);
#end
+
+ /* The following can be used instead of the line above to
+ guarantee the related object contains a reference
+ to this object, but this level of coupling
+ may be undesirable in many circumstances.
+ As it can lead to a db query with many results that may
+ never be used.
+ $className obj = ${className}Peer.retrieveByPK($arglist);
+ obj.add${pCollName}(this);
+ */
}
#end
return $varName;
@@ -435,10 +445,20 @@
${interfaceName}Manager.putInstance($varName);
}
#end
+
+ /* The following can be used instead of the line above to
+ guarantee the related object contains a reference
+ to this object, but this level of coupling
+ may be undesirable in many circumstances.
+ As it can lead to a db query with many results that may
+ never be used.
+ $className obj = ${className}Peer.retrieveByPK($arglist, connection);
+ obj.add${pCollName}(this);
+ */
}
return $varName;
}
-
+
/**
* Provides convenient way to set a relationship based on a
* ObjectKey, for example
@@ -459,6 +479,7 @@
#set ($i = 0)
#foreach ($colName in $fk.LocalColumns)
#set ($col = $table.getColumn($colName) )
+
#set ($fktype = $col.JavaNative)
#if ($fktype == "short")
${col.SetterName}(((NumberKey) keys[$i]).shortValue());
@@ -491,7 +512,6 @@
#elseif($fktype == "Date")
${col.SetterName}(((DateKey)keys[$i]).getDate());
#end
-
#set ( $i = $i + 1 )
#end
#else
@@ -1029,7 +1049,7 @@
}
/**
- * Retrieves a field from the object by name passed in as a String.
+ * Retrieves a field from the object by field (Java) name passed in as a String.
*
* @param name field name
* @return value
@@ -1065,6 +1085,91 @@
}
/**
+ * Set a field in the object by field (Java) name.
+ *
+ * @param name field name
+ * @param value field value
+ * @return True if value was set, false if not (invalid name / protected field).
+ * @throws IllegalArgumentException if object type of value does not match field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByName(String name, Object value )
+ throws TorqueException, IllegalArgumentException
+ {
+ #foreach ($col in $table.Columns)
+ #set ( $cjtype = $col.JavaNative )
+ if (name.equals("${col.JavaName}"))
+ {
+ #if ( ${col.isPrimitive()} )
+ #if ($cjtype == "int")
+ if (value == null || ! (Integer.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
+ }
+ ${col.SetterName}(((Integer) value).intValue());
+ #elseif ($cjtype == "long")
+ if (value == null || ! (Long.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Long object.");
+ }
+ ${col.SetterName}(((Long) value).longValue());
+ #elseif ($cjtype == "float")
+ if (value == null || ! (Float.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Float object.");
+ }
+ ${col.SetterName}(((Float) value).floatValue());
+ #elseif ($cjtype == "double")
+ if (value == null || ! (Double.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Double object.");
+ }
+ ${col.SetterName}(((Double) value).doubleValue());
+ #elseif ($cjtype == "boolean")
+ if (value == null || ! (Boolean.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Boolean object.");
+ }
+ ${col.SetterName}(((Boolean)value).booleanValue());
+ #elseif ($cjtype == "short")
+ if (value == null || ! (Short.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Short object.");
+ }
+ ${col.SetterName}(((Short)value).shortValue());
+ #elseif ($cjtype == "byte")
+ if (value == null || ! (Byte.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Byte object.");
+ }
+ ${col.SetterName}(((Byte) value).byteValue());
+ #elseif ($cjtype == "char")
+ if (value == null || ! (Character.class.isInstance(value)))
+ {
+ throw new IllegalArgumentException("setByName: value parameter was null or not a Character object.");
+ }
+ ${col.SetterName}(((Character) value).charValue());
+ #end
+ #else
+ #if ( ${col.JavaNative} )
+ // Object fields can be null
+ if (value != null && ! ${col.JavaNative}.class.isInstance(value))
+ {
+ throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
+ }
+ ${col.SetterName}(($cjtype) value);
+ #else
+ // Hmm, using column type that can't be mapped to a Java object class, make this obvious.
+ throw IllegalStateException("Can't determine Java Object type for column, ${col.Name}!");
+ #end
+ #end
+ return true;
+ }
+ #end
+ return false;
+ }
+
+ /**
* Retrieves a field from the object by name passed in
* as a String. The String must be one of the static
* Strings defined in this Class' Peer.
@@ -1104,6 +1209,28 @@
}
/**
+ * Set field values by Peer Field Name
+ *
+ * @param name field name
+ * @param value field value
+ * @return True if value was set, false if not (invalid name / protected field).
+ * @throws IllegalArgumentException if object type of value does not match field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByPeerName(String name, Object value)
+ throws TorqueException, IllegalArgumentException
+ {
+ #foreach ($col in $table.Columns)
+ #set ( $cup=$col.Name.toUpperCase() )
+ if (${table.JavaName}Peer.${cup}.equals(name))
+ {
+ return setByName("${col.JavaName}", value);
+ }
+ #end
+ return false;
+ }
+
+ /**
* Retrieves a field from the object by Position as specified
* in the xml schema. Zero-based.
*
@@ -1141,6 +1268,30 @@
#end
return null;
}
+
+ /**
+ * Set field values by its position (zero based) in the XML schema.
+ *
+ * @param position The field position
+ * @param value field value
+ * @return True if value was set, false if not (invalid position / protected field).
+ * @throws IllegalArgumentException if object type of value does not match field object type.
+ * @throws TorqueException If a problem occures with the set[Field] method.
+ */
+ public boolean setByPosition(int position, Object value)
+ throws TorqueException, IllegalArgumentException
+ {
+ #set ($i = 0)
+ #foreach ($col in $table.Columns)
+ #set ( $cup=$col.Name.toUpperCase() )
+ if (position == $i)
+ {
+ return setByName("${col.JavaName}", value);
+ }
+ #set ( $i = $i + 1)
+ #end
+ return false;
+ }
#end ## ends the if(addGetByNameMethod)
#if (!$table.isAlias() && $addSaveMethod)
@@ -1282,7 +1433,6 @@
{
${table.JavaName}Peer.doUpdate(($table.JavaName) this, con);
}
-
#if ($table.PrimaryKey.size() > 0)
#set ($tableHasPrimaryKey = true)
#else
@@ -1634,7 +1784,7 @@
{
return copyInto(new ${table.JavaName}(), deepcopy);
}
- #end
+ #end
#end
#if ($complexObjectModel)
@@ -1648,7 +1798,7 @@
return copyInto(copyObj, true);
}
#end
-
+
/**
* Fills the copyObj with the contents of this object.
#if ($complexObjectModel)
Added: db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java?rev=414572&view=auto
==============================================================================
--- db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java (added)
+++ db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java Thu Jun 15 05:57:57 2006
@@ -0,0 +1,629 @@
+package org.apache.torque.om;
+
+/*
+ * Copyright 2001-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.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.torque.BaseRuntimeTestCase;
+import org.apache.torque.TorqueException;
+import org.apache.torque.test.TypesObject;
+import org.apache.torque.test.TypesPrimitive;
+
+/**
+ * Test the various setBy and getBy methods that can be used to access field
+ * values.
+ * <p>
+ * Depends on names and ordering in the following tables to match the static
+ * fields defined in this class:
+ * <P>
+ *
+ * TypesObject table - which contain column definitions for all (AFAIK) Torque
+ * supported column types that use Java Objects for storage. E.g. Integer and
+ * not int.
+ * <P>
+ *
+ * TypesPrimitive table - which is the same as TypesObjects except that it uses
+ * primitive types for storage.
+ * <p>
+ *
+ * InheritanceTest table - which contains a protected field.
+ * <P>
+ *
+ * @author <a href="mailto:greg.monroe@dukece.com>Greg Monroe</a>
+ * @version $Id
+ */
+public class OMByNameMethodsTest extends BaseRuntimeTestCase
+{
+ public static final String PROTECTED_COLUMN_NAME = "PayLoadB";
+
+ public static final String PROTECTED_COLUMN_PEER_NAME =
+ "INHERITANCE_TEST.PAYLOAD_B";
+
+ public static final String PROTECTED_COLUMN_TABLE = "INHERITANCE_TEST";
+
+ public static final int PROTECTED_COLUMN_POSITION = 3;
+
+ public static final Object[] OBJECT_TEST_VALUES =
+ {
+ new Boolean(true), // "OBit",
+ new Byte((byte) 1), // "OTinyint",
+ new Short((short) 1), // "OSmallint",
+ new Long((long) 1.0), // "OBigint",
+ new Double(1.0), // "OFloat",
+ new Float(1.0), // "OReal",
+ new BigDecimal(1.0), // "ONumeric",
+ new BigDecimal(1.0), // "ODecimal",
+ "OChar_TEST_VALUE", // "OChar",
+ "OVarchar_TEST_VALUE", // "OVarchar",
+ "OLongvarchar_TEST_VALUE", // "OLongvarchar",
+ new Date(1000000000l), // "ODate",
+ new Date(1000000000l), // "OTime",
+ new Integer(1), // "OInteger",
+ new Date(1000000000l), // "OTimestamp",
+ new byte[]
+ {
+ 1, 1, 1
+ }, // "OBinary",
+ new byte[]
+ {
+ 1, 1, 1
+ }, // "OVarbinary",
+ new byte[]
+ {
+ 1, 1, 1
+ }, // "OLongvarbinary",
+ new byte[]
+ {
+ 1, 1, 1
+ }, // "OBlob",
+ "OClob_TEST_VALUE", // "OClob",
+ new Boolean(true), // "OBooleanint",
+ new Boolean(true), // "OBooleanchar",
+ new Double(1.0)
+ // "ODouble"
+ };
+
+ public static final String[] OBJECT_COLUMN_NAMES =
+ {
+ "OBit", "OTinyint", "OSmallint", "OBigint", "OFloat", "OReal",
+ "ONumeric", "ODecimal", "OChar", "OVarchar", "OLongvarchar",
+ "ODate", "OTime", "OInteger", "OTimestamp", "OBinary",
+ "OVarbinary", "OLongvarbinary", "OBlob", "OClob", "OBooleanint",
+ "OBooleanchar", "ODouble"
+ };
+
+ public static final String[] PRIMITIVE_COLUMN_NAMES =
+ {
+ "PBit", // boolean
+ "PTinyint", // byte
+ "PSmallint", // short
+ "PBigint", // long
+ "PFloat", // double
+ "PReal", // float
+ // "PNumeric", //BigDecimal - Skipped because same as Object
+ // "PDecimal", //BigDecimal - Skipped because same as Object
+ // "PChar", //String - Skipped because same as Object
+ // "PVarchar", //String - Skipped because same as Object
+ // "PLongvarchar", //String - Skipped because same as Object
+ // "PDate", //Date - Skipped because same as Object
+ // "PTime", //Date - Skipped because same as Object
+ "PInteger", // int
+ // "PTimestamp", //Date - Skipped because same as Object
+ // "PBinary", //byte[] - Skipped because same as Object
+ // "PVarbinary", //byte[] - Skipped because same as Object
+ // "PLongvarbinary", //byte[] - Skipped because same as Object
+ // "PBlob", //byte[] - Skipped because same as Object
+ // "PClob", //String - Skipped because same as Object
+ "PBooleanint", // boolean
+ "PBooleanchar", // boolean
+ "PDouble" // double
+ };
+
+ public static final Object[] PRIMITIVE_TEST_VALUES =
+ {
+ new Boolean(true), // "PBit",
+ new Byte((byte) 1), // "PTinyint",
+ new Short((short) 1), // "PSmallint",
+ new Long((long) 1.0), // "PBigint",
+ new Double(1.0), // "PFloat",
+ new Float(1.0), // "PReal",
+ new Integer(1), // "PInteger",
+ new Boolean(true), // "PBooleanint",
+ new Boolean(true), // "PBooleanchar",
+ new Double(1.0) //" PDouble"
+ };
+
+ public static final String[] OBJECT_PEER_NAMES =
+ {
+ "types_object.O_BIT", "types_object.O_TINYINT",
+ "types_object.O_SMALLINT", "types_object.O_BIGINT",
+ "types_object.O_FLOAT", "types_object.O_REAL",
+ "types_object.O_NUMERIC", "types_object.O_DECIMAL",
+ "types_object.O_CHAR", "types_object.O_VARCHAR",
+ "types_object.O_LONGVARCHAR", "types_object.O_DATE",
+ "types_object.O_TIME", "types_object.O_INTEGER",
+ "types_object.O_TIMESTAMP", "types_object.O_BINARY",
+ "types_object.O_VARBINARY", "types_object.O_LONGVARBINARY",
+ "types_object.O_BLOB", "types_object.O_CLOB",
+ "types_object.O_BOOLEANINT", "types_object.O_BOOLEANCHAR",
+ "types_object.O_DOUBLE"
+ };
+
+ public static final String[] PRIMITIVE_PEER_NAMES =
+ {
+ "types_primitive.P_BIT", "types_primitive.P_TINYINT",
+ "types_primitive.P_SMALLINT", "types_primitive.P_BIGINT",
+ "types_primitive.P_FLOAT", "types_primitive.P_REAL",
+ "types_primitive.P_NUMERIC", "types_primitive.P_DECIMAL",
+ "types_primitive.P_CHAR", "types_primitive.P_VARCHAR",
+ "types_primitive.P_LONGVARCHAR", "types_primitive.P_DATE",
+ "types_primitive.P_TIME", "types_primitive.P_INTEGER",
+ "types_primitive.P_TIMESTAMP", "types_primitive.P_BINARY",
+ "types_primitive.P_VARBINARY", "types_primitive.P_LONGVARBINARY",
+ "types_primitive.P_BLOB", "types_primitive.P_CLOB",
+ "types_primitive.P_BOOLEANINT", "types_primitive.P_BOOLEANCHAR",
+ "types_primitive.P_DOUBLE"
+ };
+
+ public OMByNameMethodsTest(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * Validate that the setByName methods work using a BaseObject class type.
+ * Checks the setValue against the value returned by the get<FieldName>()
+ * methods for all known object and primitive types.
+ */
+ public void testSetByNameMethod() throws Exception
+ {
+
+ // Testing SetByName method for Object Types
+ BaseObject objectTypes = new TypesObject();
+ try
+ {
+ for (int i = 0; i < OBJECT_COLUMN_NAMES.length; i++)
+ {
+ boolean status = objectTypes.setByName(OBJECT_COLUMN_NAMES[i],
+ OBJECT_TEST_VALUES[i]);
+ assertTrue("setByName returned false setting column "
+ + OBJECT_COLUMN_NAMES[i], status);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ String eMsg = "Did not get expected value for object column: ";
+ int iValue = 0;
+ // "OBit",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOBit()));
+ // "OTinyint",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOTinyint()));
+ // "OSmallint",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOSmallint()));
+ // "OBigint",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOBigint()));
+ // "OFloat",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOFloat()));
+ // "OReal",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOReal()));
+ // "ONumeric",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getONumeric()));
+ // "ODecimal",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getODecimal()));
+ // "OChar",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOChar()));
+ // "OVarchar",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOVarchar()));
+ // "OLongvarchar",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOLongvarchar()));
+ // "ODate",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getODate()));
+ // "OTime",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOTime()));
+ // "OInteger",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOInteger()));
+ // "OTimestamp",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOTimestamp()));
+ // "OBinary",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOBinary()));
+ // "OVarbinary",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOVarbinary()));
+ // "OLongvarbinary",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOLongvarbinary()));
+ // "OBlob",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOBlob()));
+ // "OClob",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOClob()));
+ // "OBooleanint",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOBooleanint()));
+ // "OBooleanchar",
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getOBooleanchar()));
+ // "ODouble"
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
+ OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
+ .getODouble()));
+ // Test Primitive Types
+ BaseObject primitiveTypes = new TypesPrimitive();
+ try
+ {
+ for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
+ {
+ boolean status = primitiveTypes.setByName(
+ PRIMITIVE_COLUMN_NAMES[i], PRIMITIVE_TEST_VALUES[i]);
+ assertTrue("setByName returned false setting column "
+ + PRIMITIVE_COLUMN_NAMES[i], status);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ eMsg = "Did not get expected value for primitive column: ";
+ // "PBit", true, //boolean
+ assertTrue(eMsg + "PBit",
+ ((TypesPrimitive) primitiveTypes).getPBit() == true);
+ // "PTinyint", (byte) 1 //byte
+ assertTrue(eMsg + "PTinyint", ((TypesPrimitive) primitiveTypes)
+ .getPTinyint() == (byte) 1);
+ // "PSmallint", (short) 1 //short
+ assertTrue(eMsg + "PSmallint", ((TypesPrimitive) primitiveTypes)
+ .getPSmallint() == (short) 1);
+ // "PBigint", (long) 1.0 //long
+ assertTrue(eMsg + "PBigint", ((TypesPrimitive) primitiveTypes)
+ .getPBigint() == (long) 1.0);
+ // "PFloat", 1.0 //double
+ assertTrue(eMsg + "PFloat", ((TypesPrimitive) primitiveTypes)
+ .getPFloat() == 1.0);
+ // "PReal", 1.0 //float
+ assertTrue(eMsg + "PReal",
+ ((TypesPrimitive) primitiveTypes).getPReal() == 1.0);
+ // "PInteger", 1 //int
+ assertTrue(eMsg + "PInteger", ((TypesPrimitive) primitiveTypes)
+ .getPInteger() == 1);
+ // "PBooleanint", true, //boolean
+ assertTrue(eMsg + "PBooleanint", ((TypesPrimitive) primitiveTypes)
+ .getPBooleanint() == true);
+ // "PBooleanchar", true, //boolean
+ assertTrue(eMsg + "PBooleanchar", ((TypesPrimitive) primitiveTypes)
+ .getPBooleanchar() == true);
+ // "PDouble" 1.0 //double
+ assertTrue(eMsg + "PDouble", ((TypesPrimitive) primitiveTypes)
+ .getPDouble() == 1.0);
+ }
+
+ /*
+ * Validate that the getBy* methods work using a BaseObject class type.
+ * Checks that getValue returns the value set with a setBy call for all
+ * known object and primitive types.
+ *
+ * @throws Exception
+ */
+ public void testGetByNameMethod() throws Exception
+ {
+ // Testing GetByName method for Object Types
+ BaseObject objectTypes = new TypesObject();
+ try
+ {
+ for (int i = 0; i < OBJECT_COLUMN_NAMES.length; i++)
+ {
+ objectTypes.setByName(OBJECT_COLUMN_NAMES[i],
+ OBJECT_TEST_VALUES[i]);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ String eMsg = "Did not get expected value for object column: ";
+ for (int i = 0; i < OBJECT_COLUMN_NAMES.length; i++)
+ {
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[i], OBJECT_TEST_VALUES[i]
+ .equals(objectTypes.getByName(OBJECT_COLUMN_NAMES[i])));
+ }
+
+ // Test Primative Types
+ BaseObject primitiveTypes = new TypesPrimitive();
+ try
+ {
+ for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
+ {
+ primitiveTypes.setByName(PRIMITIVE_COLUMN_NAMES[i],
+ PRIMITIVE_TEST_VALUES[i]);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
+ {
+ assertTrue(eMsg + PRIMITIVE_COLUMN_NAMES[i],
+ PRIMITIVE_TEST_VALUES[i].equals(
+ primitiveTypes.getByName(PRIMITIVE_COLUMN_NAMES[i])));
+ }
+ }
+
+ /*
+ * Validate that the setByPeerName methods work using a BaseObject class type.
+ * Checks that getValue returns the value set with a setByPeerName call for all
+ * known object and primitive types.
+ */
+ public void testSetByPeerNameMethod() throws Exception
+ {
+ // Testing GetByName method for Object Types
+ BaseObject objectTypes = new TypesObject();
+ try
+ {
+ for (int i = 0; i < OBJECT_PEER_NAMES.length; i++)
+ {
+ boolean status = objectTypes.setByPeerName(
+ OBJECT_PEER_NAMES[i], OBJECT_TEST_VALUES[i]);
+ assertTrue("setByPeerName returned false setting column "
+ + OBJECT_COLUMN_NAMES[i], status);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ String eMsg = "Did not get expected value for object column: ";
+ for (int i = 0; i < OBJECT_COLUMN_NAMES.length; i++)
+ {
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[i], OBJECT_TEST_VALUES[i]
+ .equals(objectTypes.getByName(OBJECT_COLUMN_NAMES[i])));
+ }
+
+ // Test Primitive Types
+ BaseObject primitiveTypes = new TypesPrimitive();
+ try
+ {
+ for (int i = 0; i < PRIMITIVE_PEER_NAMES.length; i++)
+ {
+ boolean status = primitiveTypes.setByPeerName(
+ PRIMITIVE_PEER_NAMES[i], OBJECT_TEST_VALUES[i]);
+ assertTrue("setByPeerName returned false setting column "
+ + PRIMITIVE_PEER_NAMES[i], status);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
+ {
+ assertTrue(eMsg + PRIMITIVE_COLUMN_NAMES[i],
+ PRIMITIVE_TEST_VALUES[i].equals(
+ primitiveTypes.getByName(PRIMITIVE_COLUMN_NAMES[i])));
+ }
+ }
+
+ /*
+ * Validate that the setByPostion methods work using a BaseObject class type.
+ * Checks that getByPosition returns the value set with a setByPosition call
+ * for all known object and primitive types.
+ */
+ public void testSetByPositionMethod() throws Exception
+ {
+ // Testing GetByName method for Object Types
+ BaseObject objectTypes = new TypesObject();
+ try
+ {
+ for (int i = 0; i < OBJECT_PEER_NAMES.length; i++)
+ {
+ boolean status = objectTypes.setByPosition(i,
+ OBJECT_TEST_VALUES[i]);
+ assertTrue("objectTypes.setByPosition(int, Object ) returned "
+ + "false setting position " + i, status);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesObject.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ String eMsg = "Did not get expected value for object column: ";
+ for (int i = 0; i < OBJECT_COLUMN_NAMES.length; i++)
+ {
+ assertTrue(eMsg + OBJECT_COLUMN_NAMES[i], OBJECT_TEST_VALUES[i]
+ .equals(objectTypes.getByName(OBJECT_COLUMN_NAMES[i])));
+ }
+
+ // Test Primitive Types
+ BaseObject primitiveTypes = new TypesPrimitive();
+ try
+ {
+ for (int i = 0; i < PRIMITIVE_PEER_NAMES.length; i++)
+ {
+ boolean status = primitiveTypes.setByPosition(i,
+ OBJECT_TEST_VALUES[i]);
+ assertTrue("primitiveTypes.setByPosition(int, Object) returned "
+ + "false setting position " + i, status);
+ }
+ }
+ catch (TorqueException e)
+ {
+ fail("Exception caught trying to call TypesPrimitive.setByName() "
+ + "method!\nWas OM generated with torque.addGetByNameMethod "
+ + "property = true?\nError message was: '" + e.getMessage()
+ + "'");
+ }
+ for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
+ {
+ assertTrue(eMsg + PRIMITIVE_COLUMN_NAMES[i],
+ PRIMITIVE_TEST_VALUES[i].equals(
+ primitiveTypes.getByName(PRIMITIVE_COLUMN_NAMES[i])));
+ }
+
+ }
+
+ /*
+ * Validate that various an IllegalArgumentException if thrown if the
+ * Object type of the value is not correct.
+ */
+ public void testInvalidObjectErrors() throws Exception
+ {
+ BaseObject objectTypes = new TypesObject();
+ BaseObject primitiveTypes = new TypesPrimitive();
+ // Test catching invalid object types
+ boolean error = false;
+ try
+ {
+ objectTypes.setByName("OBit", new Integer(1));
+ }
+ catch (IllegalArgumentException e)
+ {
+ error = true;
+ }
+ assertTrue(
+ "setByName for OBit column did not catch illegal object type!",
+ error);
+
+ error = false;
+ try
+ {
+ primitiveTypes.setByName("PBit", new Integer(99));
+ }
+ catch (IllegalArgumentException e)
+ {
+ error = true;
+ }
+ assertTrue(
+ "setByName for PBit column did not catch illegal object type!",
+ error);
+ }
+
+ /*
+ * Validate that a false rc is returned if non-column names passed to methods.
+ */
+ public void testInvalidNameErrors() throws Exception
+ {
+ BaseObject objectTypes = new TypesObject();
+ // Test that false status is returned for invalid column names.
+ boolean status = objectTypes.setByName("xxxOBit", new Integer(1));
+ assertFalse("Did not get a false status from setByName with "
+ + "invalid column name!", status);
+
+ status = objectTypes.setByPeerName("xxxOBit", new Integer(1));
+ assertFalse("Did not get a false status from setByPeerName with "
+ + "invalid column name!", status);
+
+ status = objectTypes.setByPosition(1000, new Integer(1));
+ assertFalse("Did not get a false status from setByPosition with "
+ + "invalid position!", status);
+ }
+
+ /**
+ * Verify that null handling (can't use them for primitives) works.
+ */
+ public void testNullHandling() throws Exception
+ {
+ BaseObject objectTypes = new TypesObject();
+ BaseObject primitiveTypes = new TypesPrimitive();
+ // Object type fields should allow nulls
+ boolean error = false;
+ try
+ {
+ objectTypes.setByName("OBit", null);
+ }
+ catch (IllegalArgumentException e)
+ {
+ error = true;
+ }
+ assertFalse("objectTypes.setByName(\"OBit\",null) did not allow "
+ + "a null value!", error);
+
+ // Primitive types should not allow null values
+ error = false;
+ try
+ {
+ primitiveTypes.setByName("PBit", null);
+ }
+ catch (IllegalArgumentException e)
+ {
+ error = true;
+ }
+ assertTrue("primitiveTypes.setByName(\"PBit\",null) allowed "
+ + "a null value!", error);
+ }
+}
Modified: db/torque/test/trunk/test-project/src/schema/test-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/schema/test-schema.xml?rev=414572&r1=414571&r2=414572&view=diff
==============================================================================
--- db/torque/test/trunk/test-project/src/schema/test-schema.xml (original)
+++ db/torque/test/trunk/test-project/src/schema/test-schema.xml Thu Jun 15 05:57:57 2006
@@ -413,4 +413,73 @@
<column name="id" required="true" primaryKey="true" type="INTEGER"
description="id column" autoIncrement="true"/>
</table>
+
+<!-- Used by TestOMSetByName but can be used to test all types as needed.
+ Modified from Generator domaintest-schema.xml -->
+
+ <table name="types_object" description="used to test the handling for all supported types">
+ <column name="o_bit" type="BIT" javaType="object" />
+ <column name="o_tinyint" type="TINYINT" javaType="object" />
+ <column name="o_smallint" type="SMALLINT" javaType="object" />
+ <column name="o_bigint" type="BIGINT" javaType="object" />
+ <column name="o_float" type="FLOAT" javaType="object" />
+ <column name="o_real" type="REAL" javaType="object" />
+ <column name="o_numeric" type="NUMERIC" javaType="object" />
+ <column name="o_decimal" type="DECIMAL" javaType="object" />
+ <column name="o_char" type="CHAR" javaType="object" />
+ <column name="o_varchar" type="VARCHAR" javaType="object" />
+ <column name="o_longvarchar" type="LONGVARCHAR" javaType="object" />
+ <column name="o_date" type="DATE" javaType="object" />
+ <column name="o_time" type="TIME" javaType="object"/>
+ <column name="o_integer" type="INTEGER" javaType="object"/>
+ <column name="o_timestamp" type="TIMESTAMP" javaType="object"/>
+ <column name="o_binary" type="BINARY" javaType="object"/>
+ <column name="o_varbinary" type="VARBINARY" javaType="object"/>
+ <column name="o_longvarbinary" type="LONGVARBINARY" javaType="object" />
+ <column name="o_blob" type="BLOB" javaType="object" />
+ <column name="o_clob" type="CLOB" javaType="object" />
+ <column name="o_booleanint" type="BOOLEANINT" javaType="object" />
+ <column name="o_booleanchar" type="BOOLEANCHAR" javaType="object" />
+ <column name="o_double" type="DOUBLE" javaType="object" />
+
+<!--
+Column.getJavaObject() not implimented for these types, so skipping them for now
+
+ <column name="cnull" type="NULL" />
+ <column name="cother" type="OTHER" />
+ <column name="cjavaobject" type="JAVA_OBJECT" />
+ <column name="cdistinct" type="DISTINCT" />
+ <column name="cstruct" type="STRUCT" />
+ <column name="carray" type="ARRAY" />
+ <column name="cref" type="REF" />
+-->
+ </table>
+
+<!-- Primitive types in separate table to keep row size from exceeding limits -->
+ <table name="types_primitive" description="used to test the handling for all supported types">
+ <column name="p_bit" type="BIT" javaType="primitive" />
+ <column name="p_tinyint" type="TINYINT" javaType="primitive" />
+ <column name="p_smallint" type="SMALLINT" javaType="primitive" />
+ <column name="p_bigint" type="BIGINT" javaType="primitive" />
+ <column name="p_float" type="FLOAT" javaType="primitive" />
+ <column name="p_real" type="REAL" javaType="primitive" />
+ <column name="p_numeric" type="NUMERIC" javaType="primitive" />
+ <column name="p_decimal" type="DECIMAL" javaType="primitive" />
+ <column name="p_char" type="CHAR" javaType="primitive" />
+ <column name="p_varchar" type="VARCHAR" javaType="primitive" />
+ <column name="p_longvarchar" type="LONGVARCHAR" javaType="primitive" />
+ <column name="p_date" type="DATE" javaType="primitive" />
+ <column name="p_time" type="TIME" javaType="primitive"/>
+ <column name="p_integer" type="INTEGER" javaType="primitive"/>
+ <column name="p_timestamp" type="TIMESTAMP" javaType="primitive"/>
+ <column name="p_binary" type="BINARY" javaType="primitive"/>
+ <column name="p_varbinary" type="VARBINARY" javaType="primitive"/>
+ <column name="p_longvarbinary" type="LONGVARBINARY" javaType="primitive" />
+ <column name="p_blob" type="BLOB" javaType="primitive" />
+ <column name="p_clob" type="CLOB" javaType="primitive" />
+ <column name="p_booleanint" type="BOOLEANINT" javaType="primitive" />
+ <column name="p_booleanchar" type="BOOLEANCHAR" javaType="primitive" />
+ <column name="p_double" type="DOUBLE" javaType="primitive" />
+ </table>
+
</database>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org