About LockModeType

manual

Locking in JPA

Explains how to use optimistic locking and pessimistic locking in JPA.... lock modes are: PESSIMISTIC_READ LockModeType.PESSIMISTIC_READ enum constant Pessimistic read lock. ... a shared lock. PESSIMISTIC_WRITE LockModeType.PESSIMISTIC_WRITE enum constant Pessimistic write ...

 
api-jpa

javax.persistence.LockModeType

Lock modes can be specified by means of passing a LockModeType argument to one of the javax.persistence.EntityManager methods that take locks (lock, find, or refresh) or to the Query.setLockMode() or TypedQuery.setLockMode() method.(Enum of JPA)

 
manual

Setting and Tuning of JPA Queries

Explains various JPA query settings - result range, flush and lock.... See JavaDoc Reference Page... ( LockModeType javax.persistence.LockModeType JPA enum Lock modes can be specified by means of passing a LockModeType argument to one of the javax.persistence.EntityManager methods ...

 
api-jpa

JPA Miscellaneous

Reference (JavaDoc) of JPA API, including PersistenceUtil, PersistenceUnitUtil, Cache, CacheRetrieveMode, CacheStoreMode, FlushModeType, LockModeType, PessimisticLockScope.... javax.persistence.FlushModeType javax.persistence.LockModeType javax.persistence.PessimisticLockScope ...

 
forum_thread

"Attempt to lock a non entity object" error

Probably a simple answer for someone who's been using ObjectDB for awhile: I'm reading objects from the database outside a transaction (inside doesn't seem to matter). First cycle of doEdit and then doCancelEdit works fine. Second time I doEdit produces the error "Attempt to lock a non entity object" session.rollback() is somehow causing the problem (found through debugging) Is this enough information for someone to suggest what might be happening and how to fix it? ... getSelectedValue ( ) , LockModeType . PESSIMISTIC_WRITE ) ; . . } //doEdit ... ; import javax. persistence . LockModeType ; import javax. persistence . Persistence ; ... , 1 ) ; em. lock ( p, LockModeType . PESSIMISTIC_WRITE ) ; System. out . ...

 
api-jpa

values()

Returns an array containing the constants of this enum type.(Static Method of javax.persistence.LockModeType)

 
api-jpa

lock(entity, lockMode, properties)

Lock an entity instance that is contained in the persistence context with the specified lock mode type and with specified properties.(Method of javax.persistence.EntityManager)

 
api-jpa

refresh(entity, lockMode, properties)

Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock it with respect to given lock mode type and with specified properties.(Method of javax.persistence.EntityManager)

 
api-jpa

find(entityClass, primaryKey, lockMode, properties)

Find by primary key and lock, using the specified properties.(Method of javax.persistence.EntityManager)

 
forum_thread

Unable to persist TreeMap

import java.util.SortedMap; import java.util.TreeMap; import javax.persistence.Entity; //---------------- @Entity class Person { public SortedMap<String, String> memberships = new TreeMap<String, String>(); } //Person   ... ; import javax. persistence . LockModeType ; import javax. persistence . Persistence ; ...