-->
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: Mapping State Pattern objects
PostPosted: Wed May 02, 2007 5:41 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Has anyone out there started using the State Pattern (http://en.wikipedia.org/wiki/State_pattern) with NHibernate?

I'm trying to figure out the strategy for mapping the state objects - I'd like to simply use a single value within the DB record of the context object (an int, or char for example) to express the state but would like these values to be transformed into corresponding state objects and back again when loading and saving the context object.

Does anyone have any suggestions on how this might be accomplished?

Cheers,

Symon,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 6:26 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:08 pm
Posts: 26
I done it with Hibernate. In fact I've done it two different ways. I have documented my solution on my blog, Joe's Bit Bucket. I won't retype my solution here. You can see it in my blog post entitled State Pattern Persistence with Hibernate.

If you like my solution, please rate this forum post so that I can get some forum credits. If you don't like my solution...well...that's your problem, not mine. :-)

PS - Sorry for any code indentation issues with my blog post. That's Blogger's fault. :-(


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.