aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate Exception “illegally attempted to associate a proxy with two open Sessions” Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Exception “illegally attempted to associate a proxy with two open Sessions”" Watch "Hibernate Exception “illegally attempted to associate a proxy with two open Sessions”" New topic
Author

Hibernate Exception “illegally attempted to associate a proxy with two open Sessions”

Ashok Mor
Ranch Hand

Joined: Jul 17, 2007
Posts: 44
Hi

I get hibernate exception “illegally attempted to associate a proxy with two open Sessions”. I tried many wayto resolve this issue but could not find any solutions.

Scenario which I follow is as below:

• Hibernate transaction is stated
• I create new instance of class A
• Load object from DB using HB session, and associates them to newly created instance of A
• Now I create new hibernate transaction and try to save instance of A, on hibernate save here it throws “illegally attempted to associate a proxy with two open Sessions”

Can anyone please suggest way to get out of this HB exception?

Note: I really need to save instance of A into separate transaction then where I created instance of A and loaded it’s associated instances.

Thanks
Ashok Mor
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate Exception “illegally attempted to associate a proxy with two open Sessions”