• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and Struts Design

 
G Mehta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to write an app with struts and hibernate. However, I am a bit confused regarding the design strategy to use.

Struts Action-->Business Delegate-->Session Facade-->DAO-->Hibernate....

So what should be returned back to the Struts Layer or JSP page?
Should it be an Hibernate Object or a DTO?

Help would be appreciated.

URL to reference sites re. hibernate and struts design strategy would be helpful.

Thanks
Gautam Mehta
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DTOs are not needed with Hibernate, just pass the POJO.
 
G Mehta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying.. Please bare with me... new to this...

POJO, as in the Java Class created by the Hibernate tool?

If I do return a POJO, an hibernate object, to the JSP page I persume that on that POJO object you can call a method e.g. getList() which in turn may go to the Database direct in stead of going through the Layers i.e Action-->BD-->SF-->DAO-->... Is that correct?

I think I am having problems visioning this? Can any one help sort the confusion out.

Thanks
Gautam
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possibly, depending on how you are using it. A POJO is just a class with properties and accessor/mutator methods. Typically you would handle the interaction with the DB (i.e. all the functionallity which makes calls to the Session) in a distinct layer, but nothing is gained by then transfering all the properties of a POJO to DTO since POJO and DTO in this case are almost synonomous.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic