Thread:
 ordinal - be careful 
 Lajcik   05 Jul 2007, 06:16 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: Lajcik (05 Jul 2007, 06:16) Replies: 0, Views: 3505
Subject: ordinal - be careful
POST QUESTIONS ON THE FORUM! COMMENTS HERE SHOULD ADD VALUE TO THE 
PAGE!I would be careful with ordinals. Since it returns the index of 
the 
declaration in the enum  - the number returned may change if you add 
new values to the enum and youll get a mess when merging with old data.

To be safe you'd have to remember to add new values at the end of the 
enum and not to reorder your existing values. Good enough if you know 
that the enum wont change, but otherwise i would stick with the variant 
with .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]