Hibernate ORM UserType - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM UserType class.

This code example shows how to use the following methods:stringToEnum
  public Object nullSafeGet(ResultSet resultSet, String[] columnNames, Object owner) throws HibernateException, SQLException {
    String databaseValue = resultSet.getString(columnNames[0]);
    if (resultSet.wasNull()) {
      return null; 
    return stringToEnum(databaseValue);
  protected String enumToString(final E value) {
    return _enumToString.get(value);
  @SuppressWarnings({ "unchecked", "deprecation" }) 
  public void nullSafeSet(PreparedStatement stmt, Object value, int index) throws HibernateException, SQLException {
    if (value == null) { 
      // NOTE kirk 2010-06-11 -- This has to remain deprecated due to a bug in Hibernate 3.5.2 
      // where they deprecated the constants there (e.g. Hibernate.STRING) but didn't put in 
      // the StringType.INSTNANCE you're supposed to use instead. 
      // When we upgrade to a new hibernate which doesn't have this bug, we need to change. 
See Code Examples for Hibernate ORM UserType Methods: