-->
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: Merge has no effect
PostPosted: Wed Sep 13, 2006 1:51 am 
Newbie

Joined: Tue Mar 21, 2006 1:29 pm
Posts: 9
Hi,

I create a small test to check the merge functionality.

I basically:

1) retreive in one session (via JpaTemplate) an object.
2) Modify the object
3) from another session (still via JpaTemplate) merge the object.

When I check the database the object is not changed?

Here is a part of the code:
Code:
public void testUpdateColorStone() {
      System.out.println("sssss START ssss");
      TestObject testObject = (TestObject) testDAO.findByReference("Test");
      System.out.println(testObject .getComments());
      testObject .setComments("last comments");
      System.out.println(testObject .getComments());
      testDAO.merge(testObject );
   }

I don't see in the log file any update statement!

My DAO use the entityManager to create a session.

[main] DEBUG org.springframework.orm.jpa.JpaTemplate - Creating new EntityManager for JpaTemplate execution
[main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 4743565661175808

When I use the merge in the same session/transaction as the finder, it works but not with different session. Isn't it the goal of the merge to reattach an object and save it?

Any Idea?

Thanks
Dominique


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 13, 2006 4:26 pm 
Newbie

Joined: Tue Mar 21, 2006 1:29 pm
Posts: 9
I found the solution, I had a problem with the jpaTemplate configuration and Aspect configuation for the transaction management.

Dominique


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.