Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EntityManager problem when calling from hierarchy of session beans

 
Marko Novakovic
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one session bean that is calling few other session beans. If i call EntityManager.persist(myObject) within first session bean (called from servlet), i can see in APPServer's console Hibernate's INSERT statement.

If i stop application server at this point, i can't see this record inserted in database. After that persist, i am calling other session bean with saved entity as argument. When i call manager.refresh(myObject) i get EntityNotManaged exception...

What can be the problem? I guess something with transactions, but had anyone had those problems?

I am using GlassFish V2 with hibernate as JPA provider
[ July 13, 2008: Message edited by: Marko Novakovic ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using the Extended Entity Manager when you get them injected?

Of course you won't see you insert if you stop you app server in the middle of a transaction. The transaction hasn't committed, so therefore it will be rolled back.

Mark
 
Marko Novakovic
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, you say i am not using Extended EntityManager? Can you tell me what do you mean by it?

Do you mean Extended scope of session bean?

cheers, mn
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic