Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Transaction

 
Anurag Bhatia
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In one EJB I am doing the following operations -
1. Create entity A with primary key - id and persist A into the database.
2. Look for entity A with primary key - id.

When I do operation 2 I get a an ObjectNotFound exception. I am unable to understand why?
Should'nt the entity manager be aware of the created entity A with primary key - id.

--Anurag
 
Witold Koszulinski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You got an exception because your are not sharing the same persistence context.

Witold
 
Anurag Bhatia
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. That sorted it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic