-->
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.  [ 2 posts ] 
Author Message
 Post subject: @Enumerated - how Hibernate converts ordinal back to enum?
PostPosted: Thu Mar 30, 2006 6:31 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
For

@Enumerated(value=EnumType.ORDINAL)

how does Hibernate converts ordinal values back to enum?

For Java enum type, there is no such method.

enum.valueOf(String) is for a string.

Will have to go through all ordinal values and compare them?

Thanks for info.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 3:12 pm 
Beginner
Beginner

Joined: Wed Aug 24, 2005 5:32 am
Posts: 23
Hi,
I didn't check how Hibernate does it but one way to do it is:

Code:
Class theEnumClass;
...
Enum e = theEnumClass.getEnumConstants()[index]


I guess Hibernate takes the same, or similar, approch.

Eyal Lupu


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