flex/actionscript client entity state refresh on JPA update using Pimento EntityManager
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-05-17T23:47:51Z
Indexed on
2010/05/17
23:50 UTC
Read the original article
Hit count: 315
My Flex application uses a client-side pimento EntityManager which fetches quite a few objects and associations. It does this by forcing eager fetching of particular association ends in the form of fetch plans. I would like to update the client whenever a change has been made to an entity existing in the EntityManager's cache. Is it possible to update the state of the changed entity ONLY, including updating which entities are associated, without resetting the state of these associated entities? I have setup an EntityListener with a JPA post-update method that notifies clients when a persisted entity has been updated. I want this to trigger a refresh for the modified client-side entity, but calling EntityManager.refresh(entity) resets all lazy associations to proxies. Initializing these proxies resets the associated entities, even if they were loaded previously. I'm looking for an efficient way to keep the client's state in synch with the server's state, at least with respect to the entities that have already been retrieved by the initial load.
© Stack Overflow or respective owner