On Sun, May 27, 2012 at 2:33 AM, Fight Ice <ricr...@hotmail.com> wrote: > java code: > Transaction ts=session.beginTransaction(); > Criteria criteria=session.createCriteria(Item.class); > criteria.add(Restrictions.idEq(product.getItem().getId())); > criteria.setLockMode(LockMode.PESSIMISTIC_WRITE); > Item item=(Item)criteria.list().get(0); > ts.commit(); > Transaction tc=session.beginTransaction(); > tc.commit(); > Then I got the Exception: > Transaction not successfully started.
Any of these options: 1) If you use managed transactions (i.e. @CommitAfter) don't commit yourself 2) If you really want to use the same session, start a new transaction after committing. But it's a very questionable practice 3) Use HibernateSessionSource.create() to manage transactions manually in a separate session Kalle --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org