Chris Lb wrote:For EJB 3 the entity objects are DTOs too, or should I say they are DTOs annotated as entity objects. The annotations mark the DTOs for special use in the context(s) where the @Entity is applicable.
So, yes, they are dual purpose. In the UI they are simply DTOs. Once they get inside of an EJB transaction, they are entity objects (i.e. entity beans, but not called that) that will map changes to the underlying persistence when attributes are changed for entity instances that are already managed. persist() and merge() can be used with the entity manager (i.e. in the biz tier) within your EJBs to make a DTO that is passed into a managed entity. (using "make" loosely here)
If you inspect a managed entity in the UI, you may notice that the lists for one-to-many relationships are handled differently than regular lists and the annotated DTOs carry additional properties for the @Entity annotation effect on the DTO.
Hope that answers your question
Thanks very much for that answer. So what they are doing is this: in their session bean for the method getAllUsers, the stateless bean returns a List<User> where User is annotated as @Entity.
I include the jar with the @Entity object on my side (presentation side), i invoke their remote session bean via jndi and call the getAllUsers method. Now I have a list of User marked with the @Entity object. I don't see any transformation of the entity object, it looks just like it did on their side.. the presentation side resides on a different machine than their facade.. on my side, I dont have any JPA libs loaded, (the interfaces exist but no jpa provider).. Im to use the @Entity objects as pojo's..
does that make sense? thanks again
J.