Thread:
 Flexible EnumUserType 
 rwwilden   07 Jul 2005, 09:34 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: rwwilden (07 Jul 2005, 09:34) Replies: 0, Views: 40139
Subject: Flexible EnumUserType
The code for the nullSafeGet method of the flexible EnumUserType (Martin
Kersten) should be null-safe, which it is not now. It should be:

public Object nullSafeGet(ResultSet resultSet, String[] names,
                          Object owner)
      throws SQLException {
   Object identifier = type.get(resultSet, names[0]);
   if (identifier == null) {
      return null;
   }
   else {
      try {
         return valueOfMethod.invoke(null, new Object[] { identifier });
      }
      catch (Exception e) {
         throw new HibernateException("Exception while invoking "
            + "valueOf method '" + valueOfMethod + "' on enum class '"
            + enumClass + "'.", e);
      }
   }
}
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]