jodd.db.type
Class NullAwareSqlType<T>
java.lang.Object
jodd.db.type.SqlType<T>
jodd.db.type.NullAwareSqlType<T>
- Direct Known Subclasses:
- BooleanSqlType, ByteSqlType, CharacterSqlType, DoubleSqlType, FloatSqlType, IntegerSqlType, LongSqlType, ShortSqlType
public abstract class NullAwareSqlType<T>
- extends SqlType<T>
Null-aware sql types.
|
Method Summary |
|
readValue(java.sql.ResultSet rs,
int index,
java.lang.Class<E> destinationType,
int dbSqlType)
Detects if there was a null reading and returns null if it was. |
void |
storeValue(java.sql.PreparedStatement st,
int index,
java.lang.Object value,
int dbSqlType)
Detects null before storing the value into the database. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NullAwareSqlType
public NullAwareSqlType()
readValue
public <E> E readValue(java.sql.ResultSet rs,
int index,
java.lang.Class<E> destinationType,
int dbSqlType)
throws java.sql.SQLException
- Detects if there was a
null reading and returns null if it was.
Result set returns default value (e.g. 0) for many getters, therefore it detects if it was
a null reading or it is a real value.
- Overrides:
readValue in class SqlType<T>
- Parameters:
rs - result setindex - database column indexdestinationType - property typedbSqlType - hint for column sql type value
- Throws:
java.sql.SQLException
storeValue
public void storeValue(java.sql.PreparedStatement st,
int index,
java.lang.Object value,
int dbSqlType)
throws java.sql.SQLException
- Detects
null before storing the value into the database.
- Overrides:
storeValue in class SqlType<T>
- Throws:
java.sql.SQLException
Copyright © 2003-2012 Jodd Team