I don't know much about the benefits of using proxies, but in our particular usage, all proxies should be removed when the entity is detached/serialized. Then we can use entities directly in GWT avoiding DTOs and also with this, client side will not have dependency on OpenJPA at runtime.
Regards, Prashant On Wed, Mar 23, 2011 at 9:22 PM, Michael Dick <michael.d.d...@gmail.com>wrote: > I haven't had a chance to look at your example application, but I think we > need to make some changes to the way we handle proxies. > > Currently there's no way to prevent proxies from being inserted. It's not > intuitive when they will be inserted, and they can be tough to remove. What > I'd propose is to make it work something like this : > > if openjpa.ProxyManager.TrackChanges == False : > # No proxies are inserted. Ever. > > else : > > if openjpa.DetachState.DetachedStateField == "true": > # proxies are inserted when the entity is flushed (or committed) > # proxies are not removed when the entity is detached > # proxies are not removed when the entity is serialized > > elif openjpa.DetachState.DetachedStateField == "transient" : > # proxies are inserted when the entity is flushed (or committed) > # proxies are not removed when the entity is detached > # proxies are removed when the entity is serialized > > elif openjpa.DetachState.DetachedStateField == "false" : > # proxies are inserted when the entity is flushed (or committed) > # proxies are removed when the entity is detached > # proxies are removed when the entity is serialized > > From what I've seen none of these are accurate for trunk, and the related > code path is a bit tangled (or I just haven't groked it). > > For your specific use case, would you want the proxies to ever be inserted? > > -mike > >