Did you try looking at the Hibernate example app on hibernate.org? Gavin built it with 
WebWork2... 

> -----Original Message-----
> From: Erik Jõgi [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, January 18, 2004 10:20 AM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] WebWork2 with Hibernate
> 
> 
> hello,
> 
> First of all: many thanks to the creators of WW2 for building 
> this great framework.
> 
> I am trying to write an application with WebWork2 that is 
> also using Hibernate.
> 
> This is my first WebWork project so I'm not sure what is the 
> best way to use these to together. I tried to search in the 
> wiki but couldn't find much there either.
> 
> Initially I came up with this setup: I have 2 components: 
> HibernateSessionFactory at application scope and 
> HibernateSession at request scope. The HibernateSession is 
> HibernateSessionFactoryAware and any action that needs 
> Hibernate is then HibernateSessionAware. The HibernateSession 
> also implements Initializable and 
> Disposable where it opens a session and closes the session 
> respectively. Now
> 
> in my actions I use hibernateSession.getSession() to retrieve 
> the actual Hibernate Session object.
> 
> This seems to work fine but what I would like more is that 
> the Actions could have already the real Hibernate's Session 
> object assigned to them instead of having to call 
> hibernateSession.getSession() every time it is needed.
> 
> Now for this I came up with a different approach and I would 
> like to get some 
> comments whether this is a good idea or could it even be done 
> that way at
> all:
> 
> I thought of building an Interceptor that would take care of 
> initializing Hibernate and before any action check if the 
> action implements SessionAware and then open a Session and 
> assign it to that Action. After the action it would then 
> close the session if one was opened. 
> 
> For this I was also wondering: 
> 
> What is the scope of an Interceptor instance? Is there a new 
> one created for each request?
> 
> For any custom interceptor: what is the recommended way to 
> deal with exceptions?
> 
> Any comments on my ideas would be greatly appreciated.
> 
> best regards,
> erik jõgi
> 
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration 
> See the breadth of Eclipse activity. February 3-5 in Anaheim, 
> CA. http://www.eclipsecon.org/osdn 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to