chirag jain

Greenhorn
+ Follow
since Oct 08, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by chirag jain

this is my closeEntityManager() method:



Entity manager and transaction should be nested, the transaction within the entity manager.



This transaction is not hibernate transaction. This is JTA transaction and we are using it with EJB 2.0.


My jpa work is done inside session ejb method, so entity manager has to be nested in JTA transaction.
As I have described in my previous post, I have tried by closing entity manager, but not working...

transaction.start();
entitymanager = createEntityManager();
entityObj = entitymanager.find();
closeEntityManager(entitymanager );
entityObj.setField1(value);
transaction.commit();
then is there any way to "detach" the entity from persistence context?
But here I am not calling persist() or merge(), then why the changes made to entity object are persisted in table? I have tried by closing entity manager, but still it does not work..



after this, data in table changes in column mapped to field1.

What is the solution??
I am using JPA with hibernate. When I use



then change the entityObj by using its setters, and commit the JTA transaction , changed data is geting saved in table without calling persist() or merge().

Ex:

after this, data in table changes in column mapped to for field1.

What can be the problem?