aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Transaction" Watch "EJB Transaction" New topic
Author

EJB Transaction

Anurag Bhatia
Greenhorn

Joined: May 12, 2009
Posts: 27
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

Joined: Aug 12, 2007
Posts: 3
You got an exception because your are not sharing the same persistence context.

Witold


SCJP 5, SCWCD 5, SCBCD 5
Anurag Bhatia
Greenhorn

Joined: May 12, 2009
Posts: 27
Thanks. That sorted it out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Transaction