-->
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: Hibernate EM and suspended transactions
PostPosted: Fri Jun 13, 2008 6:18 pm 
Newbie

Joined: Tue Mar 18, 2008 12:34 pm
Posts: 6
Hibernate EM: 3.3.0.GA

Hi all,
I would like to know where can I find more information about persistence context and suspended transactions.
I'm getting some weird results when using requires new (suspend the current transaction and creates a new one) where I have the same entity changed in different transactions.

Eg.

Code:

main()
{
// create new transaction
Entity entity = new Entity();
entitiManager.persist( entity );
changeStatus1( entity );
changeStatus2( entity );
// commit
}

changeStatus1( Entity entity )
{
// suspend and create one transaction
entity.setAttribute1( "abc" );
entityMaganer.merge( entity );
// commit
}

changeStatus2( Entity entity )
{
// suspend and create one transaction
entity.setAttribute2( "abc" );
entityMaganer.merge( entity );
// commit
}


Is this kind of thing currently supported? Specificaly I'm getting wrong result where I have a cascade relationship (merge, persist). The related entity get inserted multiple times in database.

Any help is appreciated. Thanks.


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.