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.  [ 3 posts ] 
Author Message
 Post subject: Combining Save and SaveOrUpdate
PostPosted: Tue Apr 14, 2009 12:32 pm 
Newbie

Joined: Mon Nov 17, 2008 9:03 am
Posts: 4
Hi,

I'm writing a data access layer and would like to combine the Save and SaveOrUpdate methods so that the user doesn't need to worry about which one to use. I thought about using an IsTransient property for all my domain entities but then realised that I'd need to have a column in each table to store the value.

Is there a better way of doing this? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 14, 2009 1:26 pm 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
If you don't use assigned ids, you don't have to worry at all. You can use SaveOrUpdate() anytime and hibernate uses the correct command.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 14, 2009 4:05 pm 
Newbie

Joined: Mon Nov 17, 2008 9:03 am
Posts: 4
Ah I see, thank you very much!


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