openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chintan4181 <>
Subject Need help to understand how getDirtyObjects() works.
Date Mon, 04 Apr 2011 15:54:01 GMT

In my project we are exposing stateless ejb and exposed to other system as a
web service. it has CRUD operations. During Read operation, i am fetching
object from database. and make a change in this object. After that i am
calling Update operation to check whether there are any dirty objects or
not. But it doesn't give me any dirty objects. My code snippet is as below:

//get the entity manager using @persistentcontext
private EntityManager em;    		

Read():Loan loan = (Loan) em.createNamedQuery("findByCert_ID", Loan.class)
    				     .setParameter("Cert_ID", certId)

    	OpenJPAEntityManager oem = OpenJPAPersistence.cast(em); 
		Collection dirtyObjects =oem.getDirtyObjects();"Dirty Objects:" +dirtyObjects.size()); //this prints 0

I am getting collection.size = 0. 
Doest the EntityManager(em) is closed after read operation? Can somebody
explain me? How do i know which objects are dirty in update()?


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message