• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and objects propagation

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it condsidered an OK design to propagate the entity objects to the views in a JEE application?

For example: Is it ok to set a persistent object in the Http request so its peoperties is displayed to the user?
If not, what are the alternatives?

Note: In a larg application it will be very time consuming to create another bean for every persistent object.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly.

The big thing to Java EE 5 and EJB3 is that now you can send the domain objects to the client. Before EJB 3 Entity Beans were not Serializable, so we create the dreaded DTO Antipattern. Now we have our "Entity Beans" as POJOs so they can be Serializable and sent to the client. That is the best practice. And if you have a version field, you can re-attach these detached objects with optimistic locking.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic