-->
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: Save or SaveOrUpdate the same behaviour?
PostPosted: Fri Apr 28, 2006 10:33 am 
Newbie

Joined: Thu Jan 12, 2006 9:41 am
Posts: 15
Location: France
Hi everyone!

Yesterday, I tested my DAO layer with a simply Pojo and I got surprised that a save and saveOrUpdate have the same behaviour.

Here is my unit test:

<code>

private Person person = null;
private PersonManager manager = null;

public void setUp() {

manager = (PersonManager) ctx.getBean("personManager");

}

public void testSave() {
person = manager.getPerson(new Integer(3));
person.setName("Tim");
manager.save(person);
}

</code>

The person has been updated with a name = Tim but i don't call saveOrUpdate.

Can anyone explain that?

Thanks


Top
 Profile  
 
 Post subject: Re: Save or SaveOrUpdate the same behaviour?
PostPosted: Fri Apr 28, 2006 10:59 am 
Regular
Regular

Joined: Wed Feb 22, 2006 11:28 am
Posts: 65
Location: Santiago, Chile
Hello Friend:

I think that´s wierd. I went to see Hibernate API Doc, i found the follow phrase at a Method saveAndUpdate, it indicate your observation:

Either save() or update() the given instance, depending upon the value of its identifier property. By default the instance is always saved.

request for comments.


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.