Re: Hibernate sessions (was Re: [vote results] FOM)

2003-06-19 Thread Jeremy Quinn
On Thursday, June 19, 2003, at 08:20 AM, Ugo Cei wrote: Jeremy Quinn wrote: is that: var session = Package.package.name.Persistence.getSession(); ? Yep. Phew ;) Would you do something like this, if you wanted to use Transactions? : Yes. What's important is that you must perform your transaction

Re: Hibernate sessions (was Re: [vote results] FOM)

2003-06-19 Thread Ugo Cei
Jeremy Quinn wrote: is that: var session = Package.package.name.Persistence.getSession(); ? Yep. Would you do something like this, if you wanted to use Transactions? : var transaction; try { transaction = session.beginTransaction(); session.saveOrUpdate(model); transaction.commit(); } ca

Re: Hibernate sessions (was Re: [vote results] FOM)

2003-06-18 Thread Jeremy Quinn
On Wednesday, June 18, 2003, at 02:14 PM, Ugo Cei wrote: Jeremy Quinn wrote: Because (I just realised) the Session has to be thrown away if there is any kind of Hibernate Exception, I was beginning to realise the only way of handling that safely was to wrap each call to Hibernate with a new Ses

Re: Hibernate sessions (was Re: [vote results] FOM)

2003-06-18 Thread Ugo Cei
Jeremy Quinn wrote: Because (I just realised) the Session has to be thrown away if there is any kind of Hibernate Exception, I was beginning to realise the only way of handling that safely was to wrap each call to Hibernate with a new Session. Not every call to Hibernate but every HTTP request p

Re: Hibernate sessions (was Re: [vote results] FOM)

2003-06-18 Thread Jeremy Quinn
On Wednesday, June 18, 2003, at 10:53 AM, Ugo Cei wrote: Jeremy Quinn wrote: I open a new Hibernate Session at Function invocation, closing it on exit. FWIW, I've used this pattern in the past and it caused me some problems. In particular, you risk leaving a session open whenever the user does

Hibernate sessions (was Re: [vote results] FOM)

2003-06-18 Thread Ugo Cei
Jeremy Quinn wrote: I open a new Hibernate Session at Function invocation, closing it on exit. FWIW, I've used this pattern in the past and it caused me some problems. In particular, you risk leaving a session open whenever the user does not complete the form submission. In my latest project, I'