Thread:
 EnumUserType doesn't compile.. here's the fix 
 famousactress   31 May 2006, 13:43 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: famousactress (31 May 2006, 13:43) Replies: 0, Views: 25617
Subject: EnumUserType doesn't compile.. here's the fix
The .name() change from toString() was a good one, but there's a missing
case.. NullSafeSet should look like:

public void nullSafeSet(PreparedStatement preparedStatement, Object
value, int index) 
  throws HibernateException, SQLException {

  if (null == value) {
    preparedStatement.setNull(index, Types.VARCHAR);
  } else {
    preparedStatement.setString(index, ((Enum)value).name());
  }
}
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]