-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to implent PersistentEnum classes?
PostPosted: Wed Feb 02, 2005 12:43 pm 
Beginner
Beginner

Joined: Mon Jan 31, 2005 7:53 am
Posts: 32
Location: Madrid - Spain
Hi mates, I wonder how to implement classes based on PersistentEnum in Hibernate 3.0. Is there any new alternative to do things like the one shown below?

Code:
package com.foo;

public final class Gender extends PersistentCharacterEnum
{
    public static final Gender MALE = new Gender("male", 'M');
    public static final Gender FEMALE = new Gender("female", 'F');
    public static final Gender UNDETERMINED = new Gender("undetermined", 'U');

    private Gender(String name, char persistentValue)
    {
        super(name, persistentValue);
    }
}


How are mapped enum classes in Hibernate 3.0 if PersistentEnum class is now deprecated (and no longer supported)?

Thanks to all! ;)

PS: Complete source from http://www.hibernate.org/203.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 6:17 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
We do it implementing a custom type.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 7:01 am 
Beginner
Beginner

Joined: Mon Jan 31, 2005 7:53 am
Posts: 32
Location: Madrid - Spain
Thanks Emmanuel! ;)

I just want to add the following link to show a possible example of how to do that:

http://www.hibernate.org/172.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 11:04 am 
Beginner
Beginner

Joined: Thu Aug 26, 2004 5:53 am
Posts: 37
or, if you are using hibernate 3 and java 5 you can use jdk enums :

http://www.hibernate.org/272.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.