[jboss-user] [EJB 3.0] - Re: Detach entities - Obtaining a clear pojo
fatbatman
do-not-reply at jboss.com
Mon Sep 4 14:40:56 EDT 2006
I'm aware of why LazyInitilizationException's are thrown, and know I could do something like you demonstrated. My point though is this, as I understand things DTO's are no longer fashionable in EJB3 and entiy classes are POJO's which can be populated, then moved between the application tiers. This works fine unless you need to send the object to remote client, in which case you get the issue mentioned above. You can of course do some kind of manual cloning, but isn't doing such a thing very similar to creating a DTO albeit of the same class?
Or you can create your own custom serialisation/encoding (perhaps using something like XStream as mentioned by Gavin in the URL), but then are the entities really POJO's if you have to do that?
I understand that hibernate needs to add some magic for it to operate, but I'm requesting that there is some kind of method within Hibernate to return a version of the entity (probably a specially constructed instance/clone) with all traces of Hibernate removed.
The "hibernate cleanser" as discussed at http://blog.murf.org/2005/04/06/lazy-loading-and-the-hibernate-cleanser/ proposes a similar thing but I couldn't find any source code.
Does anyone else thing this would be a useful function? or am I missing something?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969283#3969283
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969283
More information about the jboss-user
mailing list