| Code with Finding: |
class PersistentDateTimeTZ {
public Object nullSafeGet(ResultSet resultSet, String[] strings, Object object) throws HibernateException, SQLException
{
Object timestamp = Hibernate.TIMESTAMP.nullSafeGet(resultSet, strings[0]);
Object timezone = Hibernate.STRING.nullSafeGet(resultSet, strings[1]);
if (timestamp == null || timezone == null)
{
return null;
}
return new DateTime(timestamp, DateTimeZone.forID(timezone.toString()));
}
}
class PersistentDateTimeTZ {
public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException
{
if (value == null)
{
Hibernate.TIMESTAMP.nullSafeSet(preparedStatement, null, index);
Hibernate.STRING.nullSafeSet(preparedStatement, null, index+1);
}
else
{
DateTime dt = (DateTime) value;
Hibernate.TIMESTAMP.nullSafeSet(preparedStatement, dt.toDate(), index);
Hibernate.STRING.nullSafeSet(preparedStatement, dt.getZone().getID(), index+1);
}
}
}
|