-->
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: recommendation for use of saveOrUpdateCopy
PostPosted: Thu Mar 31, 2005 9:47 am 
Newbie

Joined: Thu Feb 24, 2005 8:49 am
Posts: 6
I am wondering about the use of
Code:
saveOrUpdateCopy()
operation in
Code:
HibernateTemplate
.
When it is recommended to use
Code:
saveOrUpdateCopy()
versus the regular operation
Code:
saveOrUpdate()
. In my application, for update of an object I need to make a comparison between the new object passed with the existing object in the database and I do the update for the new object, but I am getting the NonUniqueObjectException, but this is resolved once I used the
Code:
saveOrUpdateCopy()
method.

Is it being recommended to use
Code:
saveOrUpdateCopy()
under this situation? Or is there any other better alterantive?

Environment: Spring version = 1.1.1, hibernate (v 2.x)

UpdateBusinessObj(A a1)
{
A a2 = template.get(a, a.getIdentifer());
// do some business validation between a1 and a2
template.update(a1); // this lines throws NonUniqueObjectException exception
}

Your help is highly appreciated.

Arshad




Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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.