-->
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.  [ 1 post ] 
Author Message
 Post subject: Persist enumeration with literals
PostPosted: Fri Jan 12, 2007 7:34 am 
Newbie

Joined: Tue Nov 16, 2004 5:39 am
Posts: 3
Hello forum,

As a common issue, my domain model contains some enumerations and there are several ways to persist an enumeration to a database.

Now, that I've started a new project (and a database schema) from scratch, I've asked myself, what is the most elegant / handy / best practise approach to persist an enumeration (with all it's literals) to a database?

To use the common ColorTypeEnumeration as example:


Code:
public class car {
   public ColorTypeEnumeration color;
}

public enum ColorTypeEnumeration {
    BLACK,
    RED;
}


What's the best practise to define a Hibernate Mapping (hbm-file) to persit the enumeration and all it's literals (BLACK, RED) into the database?

I've read the "UserType for persisting an Enum" docs (http://www.hibernate.org/265.html), but does this solution persits the literals of the enumeration?


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

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.