More on Wicket/Hibernate...

2007-10-04 Thread Neil B. Cohen
I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been

Re: More on Wicket/Hibernate...

2007-10-04 Thread Stanczak Group
It's really very simple. I'm doing the same thing here. You simple use the HibernateUtil example that is in the Hibernate documentation. Then you simple create a custom RequestCycle by overriding this method in your application. With the request cycle you can open and close Hibernate seesion.

Re: More on Wicket/Hibernate...

2007-10-04 Thread Neil B. Cohen
Martijn Dashorst wrote: According to me you can use Hibernate's thread local session if you want (you still need the custom request cycle though!). This removes the need for all the casting and getting. Session.get().createCriteria(SysUser.class).add(.).uniqueResult(); Hibernate

Re: More on Wicket/Hibernate...

2007-10-04 Thread Martijn Dashorst
According to me you can use Hibernate's thread local session if you want (you still need the custom request cycle though!). This removes the need for all the casting and getting. Session.get().createCriteria(SysUser.class).add(.).uniqueResult(); Hibernate session, not Wicket's

Re: More on Wicket/Hibernate...

2007-10-04 Thread Igor Vaynberg
this can all be done independently of wicket using a servletcontextlistener for sessionfactory start/shutdown and a servlet filter for closing the session at the end of requests. go for the simplest things first :) -igor On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: Another piece I

Re: More on Wicket/Hibernate...

2007-10-04 Thread Michael Laccetti
If you are using Spring, you may be interested in a Servlet Filter that supports opening/closing sessions on a per-request basis: http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.html Mike Neil B. Cohen wrote: I suspect

Re: More on Wicket/Hibernate...

2007-10-04 Thread Stanczak Group
Another piece I forgot to add is the config and shutting down of the factory. I use this in the WebApplication: @Override protected void init() { try { HibernateUtil.setSessionFactory(new Configuration().configure().buildSessionFactory()); } catch (Throwable e)

Re: More on Wicket/Hibernate...

2007-10-04 Thread Nathan Hamblen
Neil B. Cohen wrote: Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? We have one of those: http://databinder.net/site/show/baseball-players I don't know if you want to use Databinder or not, but you aren't going to find a lot of code or

Re: More on Wicket/Hibernate...

2007-10-04 Thread Neil B. Cohen
Michael Laccetti wrote: If you are using Spring, you may be interested in a Servlet Filter that supports opening/closing sessions on a per-request basis: http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.html Mike

Re: More on Wicket/Hibernate...

2007-10-04 Thread Michael Laccetti
I'm not sure if Spring is something that really requires much learning - More than anything it is a good way of tying together a bunch of disparate frameworks for use together. Neil B. Cohen wrote: Michael Laccetti wrote: If you are using Spring, you may be interested in a Servlet Filter