org.alfresco.ibatis
Class SerializableTypeHandler

java.lang.Object
  extended by org.alfresco.ibatis.SerializableTypeHandler
All Implemented Interfaces:
org.apache.ibatis.type.TypeHandler

public class SerializableTypeHandler
extends java.lang.Object
implements org.apache.ibatis.type.TypeHandler

MyBatis 3.x TypeHandler for java.io.Serializable to BLOB types.

Since:
4.0

Nested Class Summary
static class SerializableTypeHandler.DeserializationException
          Marker exception to allow deserialization issues to be dealt with by calling code.
static class SerializableTypeHandler.SerializationException
          Marker exception to allow serialization issues to be dealt with by calling code.
 
Field Summary
static int DEFAULT_SERIALIZABLE_TYPE
           
 
Constructor Summary
SerializableTypeHandler()
           
 
Method Summary
 java.lang.Object getResult(java.sql.CallableStatement cs, int columnIndex)
           
 java.lang.Object getResult(java.sql.ResultSet rs, java.lang.String columnName)
           
static int getSerializableType()
           
 void setParameter(java.sql.PreparedStatement ps, int i, java.lang.Object parameter, org.apache.ibatis.type.JdbcType jdbcType)
           
static void setSerializableType(int serializableType)
           
 java.lang.Object valueOf(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SERIALIZABLE_TYPE

public static final int DEFAULT_SERIALIZABLE_TYPE
See Also:
Constant Field Values
Constructor Detail

SerializableTypeHandler

public SerializableTypeHandler()
Method Detail

setSerializableType

public static void setSerializableType(int serializableType)
See Also:
Types

getSerializableType

public static int getSerializableType()
Returns:
Returns the SQL type to use for serializable columns

getResult

public java.lang.Object getResult(java.sql.ResultSet rs,
                                  java.lang.String columnName)
                           throws java.sql.SQLException
Specified by:
getResult in interface org.apache.ibatis.type.TypeHandler
Throws:
SerializableTypeHandler.DeserializationException - if the object could not be deserialized
java.sql.SQLException

setParameter

public void setParameter(java.sql.PreparedStatement ps,
                         int i,
                         java.lang.Object parameter,
                         org.apache.ibatis.type.JdbcType jdbcType)
                  throws java.sql.SQLException
Specified by:
setParameter in interface org.apache.ibatis.type.TypeHandler
Throws:
java.sql.SQLException

getResult

public java.lang.Object getResult(java.sql.CallableStatement cs,
                                  int columnIndex)
                           throws java.sql.SQLException
Specified by:
getResult in interface org.apache.ibatis.type.TypeHandler
Throws:
java.sql.SQLException

valueOf

public java.lang.Object valueOf(java.lang.String s)
Returns:
Returns the value given


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.