Entity « Transaction « JPA Q&A





1. Can Hibernate's @Version consider changes in related entities?    stackoverflow.com

I have 2 entities: Parent and Child in a one-to-many relationship. The Parent is versioned, i.e. has a @Version field. My goal is to synchronize changes to both Parent and Child ...

2. JPA 1.0: entity locking    coderanch.com

Optimistic locking is normally recommended for web applications. Leaving locks on your database while waiting for a web application that may disappear or go to lunch is not normally a good idea. Since pessimistic locking uses databases locks, you need to keep the database transaction open. This does not really fit with the EJB model very well, as a SessionBean normally ...

3. multiple transactions with the same entity    forum.hibernate.org

Hi All, I wrote a small app that fetches a bunch of records from the db, processes each one and then saves it in the db. a transaction is opened before the fetch, committed after the first object is processed and then new transactions are created and committed for each object. What i see happening is that only the first entity ...

4. 2nd layer cache consistency upon rollback of version entity    forum.hibernate.org

I encountered a hibernate 2nd layer cache consistency issue when rolling back hibernate-managed automatic versioned entity Scenario (specific versions, etc. see below): 1. POJOs with one-to-many parent-child relationship (e.g., Invoice -> LineItems), the objects are cached with hibernate 2nd layer cache 2. Hibernate version-based optimistic locking is used on the top level entity (e.g., invoice) 3. Thread 1 added a line ...

5. refresh and lock multiple entities in one go    forum.hibernate.org

6. [JPA] Prevent entity management within a transaction?    forum.hibernate.org

Hibernate version: 3.2.6.ga via hibernate-entitymanager (JPA) using maven2 I have some entities that I consider to be read-only. They are JPA entities and ALL columns have insertable=false, updatable=false. However, the queries have to run inside of a transaction. Is there any further way to ensure that the entities are not converted for management since I won't be updating them, but cannot ...

7. Associated entities not updated in transaction    forum.hibernate.org

Hello I have two entities, Kurs and ParameterRef with a @OneToMany relation: @Entity @Table(name="KURS") public class Kurs { @Id @Column(name = "KURS_ID", nullable = false) private Integer kursId; ... @OneToMany(fetch=FetchType.LAZY, mappedBy = "kurs") private List parameterRefs = new ArrayList(); } In a transaction I create and persist a Kurs object and then uses myNewKurs.getKursId() to create and persist a ParameterRef object. ...