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.  [ 5 posts ] 
Author Message
 Post subject: How do map State Pattern?
PostPosted: Mon Jul 03, 2006 6:27 am 
Newbie

Joined: Tue Jun 20, 2006 7:28 am
Posts: 2
Does anybody know how to map a state pattern.
Something like an Order has a State. The different state the order can have is modeled using state pattern.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 6:18 pm 
Regular
Regular

Joined: Wed Jun 21, 2006 3:13 pm
Posts: 110
Are you thinking something simple along the lines of storing an enum that contains the current state of the order? If so, you could define a column of type int in the database and then map to an enum like this:

Code:
<property name="Status" column="Status" type="MobysThinkTank.mobyProject.IssueStatus, mobyProject"/>


If you have something more complicated in mind, then it might help to first talk about how you envision storing the data. Figuring out the mappings comes secondary to first understanding how you want to interact, and then store, the data.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 3:02 am 
Newbie

Joined: Tue Jun 20, 2006 7:28 am
Posts: 2
No that is not what i want. The problem is more explained in the topic below. What i want to achive is inheritance in component.


http://forum.hibernate.org/viewtopic.php?t=953687


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 3:12 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
Why don't you just use a many-to-one to your state object?

or.. maybe I'm thinking about strategy pattern now ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 7:06 am 
Regular
Regular

Joined: Wed Jun 21, 2006 3:13 pm
Posts: 110
Post your code and then we'll work out the mappings together.

It's one thing to say you want to use such and such pattern, it's quite another to actually show how you're planning to use it.


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