Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.access.types
Class ShortType  view ShortType download ShortType.java

java.lang.Object
  extended byorg.objectstyle.cayenne.access.types.AbstractType
      extended byorg.objectstyle.cayenne.access.types.DefaultType
          extended byorg.objectstyle.cayenne.access.types.ShortType
All Implemented Interfaces:
ExtendedType

public class ShortType
extends DefaultType

Addresses bugs in certain JDBC drivers that do not handle java.lang.Short properly. Recasts java.lang.Short to java.lang.Integer when binding values to PreparedStatement. Drivers that are proven to have issues with short values are Sybase and Oracle (Mac OS X only).

Since:
1.0.2

Field Summary
protected  boolean widenShorts
           
 
Fields inherited from class org.objectstyle.cayenne.access.types.DefaultType
className, procReadMethod, readMethod
 
Constructor Summary
ShortType(boolean widenShorts)
           
 
Method Summary
 java.lang.String getClassName()
          Returns a full name of Java class that this ExtendedType supports.
 java.lang.Object materializeObject(java.sql.CallableStatement st, int index, int type)
          Reads an object from a stored procedure OUT parameter, converting it to class returned by 'getClassName' method.
 java.lang.Object materializeObject(java.sql.ResultSet rs, int index, int type)
          Reads an object from JDBC ResultSet column, converting it to class returned by 'getClassName' method.
 void setJdbcObject(java.sql.PreparedStatement st, java.lang.Object val, int pos, int type, int precision)
          Initializes a single parameter of a PreparedStatement with object value.
 
Methods inherited from class org.objectstyle.cayenne.access.types.DefaultType
defaultTypes
 
Methods inherited from class org.objectstyle.cayenne.access.types.AbstractType
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

widenShorts

protected boolean widenShorts
Constructor Detail

ShortType

public ShortType(boolean widenShorts)
Method Detail

getClassName

public java.lang.String getClassName()
Description copied from interface: ExtendedType
Returns a full name of Java class that this ExtendedType supports.

Specified by:
getClassName in interface ExtendedType
Overrides:
getClassName in class DefaultType

materializeObject

public java.lang.Object materializeObject(java.sql.ResultSet rs,
                                          int index,
                                          int type)
                                   throws java.lang.Exception
Description copied from interface: ExtendedType
Reads an object from JDBC ResultSet column, converting it to class returned by 'getClassName' method.

Specified by:
materializeObject in interface ExtendedType
Overrides:
materializeObject in class DefaultType

materializeObject

public java.lang.Object materializeObject(java.sql.CallableStatement st,
                                          int index,
                                          int type)
                                   throws java.lang.Exception
Description copied from interface: ExtendedType
Reads an object from a stored procedure OUT parameter, converting it to class returned by 'getClassName' method.

Specified by:
materializeObject in interface ExtendedType
Overrides:
materializeObject in class DefaultType

setJdbcObject

public void setJdbcObject(java.sql.PreparedStatement st,
                          java.lang.Object val,
                          int pos,
                          int type,
                          int precision)
                   throws java.lang.Exception
Description copied from interface: ExtendedType
Initializes a single parameter of a PreparedStatement with object value.

Specified by:
setJdbcObject in interface ExtendedType
Overrides:
setJdbcObject in class AbstractType