Hi,
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
@PersistentContext
private EntityManager em;
Read():Loan loan = (Loan) em.createNamedQuery("findByCert_ID", Loan.class)
.setParameter("Cert_ID", certId)
.getSingleResult();
loan.setLoan_Amount(200000);
Update():
OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
Collection dirtyObjects =oem.getDirtyObjects();
LOG.info("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()?
Thanks
chintan
--
View this message in context:
http://openjpa.208410.n2.nabble.com/Need-help-to-understand-how-getDirtyObjects-works-tp6239101p6239101.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.