Created
July 12, 2018 20:37
-
-
Save scottmarlow/56a6d3c8675d6a426e86bd59fe65f166 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StateType implements UserType { | |
// this represents what the transformer will generate | |
public Object nullSafeGet(ResultSet rs, String[] names, org.hibernate.SharedSessionContract session, Object owner) throws HibernateException, SQLException { | |
return nullSafeGet(rs,names, (SessionImplementor)session, owner); | |
} | |
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { | |
int result = rs.getInt( names[0] ); | |
if ( rs.wasNull() ) return null; | |
return State.values()[result]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment