pattern « Transaction « JPA Q&A





1. Hibernate pattern for transaction reuse    stackoverflow.com

I have a base method that I'm writing in order to not repeat the same hibernate session/transaction logic over and over. It's fairly simple, but there's a specific issue that I'm ...

2. Is this a right pattern for Hibernate session/transaction management?    stackoverflow.com

we're developing an application using JSF 2.0 (primefaces) and Hibernate 3.6.1 We're following the approch of letting the higher level of the application be agnostic about the DAL framework.... that means that ...

3. Real world patterns using optimistic locking and recovery    forum.hibernate.org

Hi there, I'm trying to wrap my head around using optimistic locking properly. When I say properly, I mean being able to recover from StaleObjectStateExceptions and do the right thing. So far, I have something that looks something like this: Code: private void updateExistingRef(Ref ref, ConnectionState state) { boolean committed = false; for ...

4. Multi-transaction usage pattern    forum.hibernate.org

No, there are several patterns. The Session acts as a "persistence context", this is useful for long running "application transactions". There is a page on the Wiki/Community Area that describes the session and transaction scopes. If you need more detaild information about application design with a persistence context, read Hibernate in Action.

5. Transaction Patterns    forum.hibernate.org

What do you see as the merits/faults of the following pattern? Code: Session sess = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); try { ... do some work A ... tx.commit(); ... do some work B ... tx.commit() ... do some work C ... tx.commit(); } catch (HibernateException he) { ...

6. Transaction problem while using open session in view pattern    forum.hibernate.org

Hi All, I am putting together a generic online shop webapp using the open session in view pattern (I begin the Hibernate session as soon as the request thread hits my control servlet and end it after the page has been rendered with a servlet filter). Almost everything is working fine, but I do have a couple of issues. The first ...

7. Design pattern for handling transactions    forum.hibernate.org

This is a fairly general question involving the use of optimistic locking. The way my middle works is that I manage a home-grown "Session" that spans the lifetime of a typical user request. That in turn manages a Hibernate session/transaction. Within a session I perform operations against the ORM of arbitrary complexity and commit the Hibernate transaction at the end of ...