-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: PersistentEnum scheduled for deprecation in 2.2 ?
PostPosted: Mon Apr 26, 2004 5:38 pm 
Regular
Regular

Joined: Fri Dec 12, 2003 2:09 pm
Posts: 84
Location: San Francisco, USA
I see from the 2.1.3 release notes that PersistentEnum is deprecated. The source code reveals that PersistentEnum will not be supported in 2.2.

Why is this? Are they being replaced by a new mechanism? Or perhaps it was decided that custom UserTypes are preferred, and that people should follow the pattern in the community area?
http://www.hibernate.org/172.html

Thanks,
- nate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2004 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
custom UserTypes should now be used instead of PersistentEnums. This is much more transparent and flexible. Supporting existing PersistentEnums should not be too difficult, as they can all be handled by one UserType.


Top
 Profile  
 
 Post subject: Hibernate 2.2+ support for enums
PostPosted: Wed Apr 28, 2004 8:18 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 9:11 pm
Posts: 32
I'm about to move all my enums to a custom UserType. I just wanted to check in and make sure this is going to be the recommended approach with future versions of hibernate 2.2+ -- particularly with the addition of Enums in Java 1.5?

If a new mechanism is being contemplated to interact with enums in Java 1.5, we will probably wait to make this change pending what comes down the Hibernate roadmap.....

Thanks in advance,
Chris.....


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 8:22 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
There are no plans yet for Enums in 1.5, use a UserType.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 3:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If there will be enum support, it will surely be through the existing type mechanism. So using a custom UserType will surely be a safe migration path away from PersistentEnums. If you change your custom Enum classes to 1.5 Enums, it will be easy to support by changing the type of the property.


Top
 Profile  
 
 Post subject: UserType & Enums
PostPosted: Tue May 04, 2004 3:49 pm 
Newbie

Joined: Tue May 04, 2004 3:24 pm
Posts: 1
We are using typesafe enums for several fields. It looks like I have to have a single UserType implementation per enum class.

I have written a general purpose Integer enum UserType but in nullSafeGet, I don't know which enum class to create to return. Is there a way to get what class the caller is expecting to be return?

Thanks,

Colin Smith


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.