org.hibernate.OptimisticLockException Java Examples
The following examples show how to use
org.hibernate.OptimisticLockException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityVerifyVersionProcess.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void doBeforeTransactionCompletion(SessionImplementor session) { final EntityPersister persister = entry.getPersister(); if ( !entry.isExistsInDatabase() ) { // HHH-9419: We cannot check for a version of an entry we ourselves deleted return; } final Object latestVersion = persister.getCurrentVersion( entry.getId(), session ); if ( !entry.getVersion().equals( latestVersion ) ) { throw new OptimisticLockException( object, "Newer version [" + latestVersion + "] of entity [" + MessageHelper.infoString( entry.getEntityName(), entry.getId() ) + "] found in database" ); } }
Example #2
Source File: OptimisticLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void lock(Serializable id, Object version, Object object, int timeout, SharedSessionContractImplementor session) { if ( !lockable.isVersioned() ) { throw new OptimisticLockException( object, "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" ); } final EntityEntry entry = session.getPersistenceContext().getEntry( object ); // Register the EntityVerifyVersionProcess action to run just prior to transaction commit. ( (EventSource) session ).getActionQueue().registerProcess( new EntityVerifyVersionProcess( object, entry ) ); }
Example #3
Source File: HibernateOptimisticLockingFailureException.java From lams with GNU General Public License v2.0 | 4 votes |
public HibernateOptimisticLockingFailureException(OptimisticLockException ex) { super(ex.getMessage(), ex); }
Example #4
Source File: HibernateOptimisticLockingFailureException.java From spring4-understanding with Apache License 2.0 | 4 votes |
public HibernateOptimisticLockingFailureException(OptimisticLockException ex) { super(ex.getMessage(), ex); }