link.jfire.sql.field.impl.TimestampField Maven / Gradle / Ivy
package link.jfire.sql.field.impl;
import java.lang.reflect.Field;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
@SuppressWarnings("restriction")
public class TimestampField extends AbstractMapField
{
public TimestampField(Field field)
{
super(field);
}
@Override
public void setEntityValue(Object entity, ResultSet resultSet) throws SQLException
{
unsafe.putObject(entity, offset, resultSet.getTimestamp(dbColName));
}
@Override
public void setStatementValue(PreparedStatement statement, Object entity, int index) throws SQLException
{
statement.setTimestamp(index, (Timestamp) unsafe.getObject(entity, offset));
}
}