• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate/Struts question

 
Mark Stein
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A question on using Hibernate with Struts. In my design, I have my action classes, and I have my query classes (I reuse the queries in different action classes).

I've got the hibernate/struts plugin configured, so that there's only one session factory. My action class is configured properly (tested it without any logic except forwarding in it).

All the examples I've seen have the hibernate session called via Context in the action class. Is there a way to call the hibernate session from my query class (and call the query class in the action class)?

Any code examples (including imports) would be appreciated.
 
Mark Stein
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind... I figured it out. In my Action classess, I get a hibernate SessionFactory from that I stored in the ServletContext. I then pass that SessionFactory to my query classes.
 
Chris Rickey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you mind posting your Hibernate plugin code?
 
Brad Smiths
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate Plugin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic