-
1. Re: Enrity dirty checking in flushMode=MANUAL
stephen Jun 24, 2008 2:33 PM (in response to goik)Haven't tried, but falling back to the hibernate session should work:
((Session)entityManager.getDelegate()).isDirty()
-
2. Re: Enrity dirty checking in flushMode=MANUAL
goik Jun 24, 2008 4:51 PM (in response to goik)This works for me, thanks!
-
3. Re: Enrity dirty checking in flushMode=MANUAL
jeremygood Apr 2, 2009 11:01 PM (in response to goik)This is very close to the answer I am looking for as well, except for one thing. I want to know if a specific entity is dirty. I've got several different entities managed by the same entityManager and I have a need to know if one of the entities is dirty (in order to put up a confirmation dialog when the user attempts to navigate to a different entity).
Any ideas?
Thanks,
Jeremy -
4. Re: Enrity dirty checking in flushMode=MANUAL
gonorrhea Apr 3, 2009 12:19 AM (in response to goik)have you looked on the Hibernate forum? I just scanned the Hibernate Session API here:
and didn't see any methods that would be applicable.
good question...
maybe this would work:
If you know which entity you're interested in checking then do this:
EquipmentRepair equipmentRepair = entityManager.find(EquipmentRepair.class, repairId);
then compare all the properties of the entity's class with the values of the potentially dirty copy of the entity in the SMPC for the injected EntityManager. I'm not sure how to get the instance of an entity that is currently being managed by the EntityManager in SMPC. Is there an API for this in JPA or Hibernate???
This would basically require access to entities in the first-level cache...