-->
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: Hibernate patterns help needed
PostPosted: Thu Apr 19, 2007 6:21 pm 
Newbie

Joined: Tue Dec 19, 2006 9:08 pm
Posts: 3
Hey all - I'm new to hibernate and wanted to get some feedback from forum members that may have had a similar issue as myself. I have two tables listed below. I need to have some data in the orderStatusTable to be there as "constants" and also need to support the addition of new data by a user.
- Is there a preferred way to model this in hibernate?
- Ideally, I'd like to have some static constants in my entity class representing some of the default data loaded at deployment.

I would really be grateful to anyone who can provide me with some pointers on this.

Sample usage:
Code:
Order o = new Order();
o.setStatus(OrderStatus.NEW()); // static variable perhaps?
OrderStatus custom = new OrderStatus("my_custom_status");
o.setStatus(custom);


Table structure:

orderTable
Code:
orderId        orderStatusId
-----------------------------------------
1                    1000
2                    1001


orderStatusTable
Code:
orderStatusId         orderStatusDescription
-----------------------------------------------------------------
1000                        NEW_ORDER
1001                        COMPLETE_ORDER   
1002                        CUSTOM_STATUS


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.