-->
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: Where to assign default value of many-to-one property
PostPosted: Thu Feb 09, 2006 6:12 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
One of the things my entity classes do (or technically, the strategy classes attached to them do) is set defaults for new transient instances. It will not be uncommon to need to set a default value for a related many-to-one property. Back in the SQL/ADO world, this was a simple matter of setting the desired foreign key value. With objects, I need to set my entity's many-to-one property to a loaded, persistent instance of the related entity.

Where/how do I do that loading? My domain layer doesn't (yet) know how to load persistent entities. I already have a service layer encapsulating NHibernate, so I could define an interface for our service layer in the domain layer, implement that interface in the service layer, and then on application startup register the service layer implementation with the domain layer. But is there a better way?


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.