/** * Perform a shallow copy. * * @param source Source for the copy (copied from) * @param destination Destination for the copy (copied to) * * @return destination */ public static LockOptions copy(LockOptions source, LockOptions destination) { destination.setLockMode( source.getLockMode() ); destination.setScope( source.getScope() ); destination.setTimeOut( source.getTimeOut() ); if ( source.aliasSpecificLockModes != null ) { destination.aliasSpecificLockModes = new HashMap<String,LockMode>( source.aliasSpecificLockModes ); } destination.setFollowOnLocking( source.getFollowOnLocking() ); return destination; } }
@Override @SuppressWarnings("unchecked") public QueryImplementor setLockOptions(LockOptions lockOptions) { this.lockOptions.setLockMode( lockOptions.getLockMode() ); this.lockOptions.setScope( lockOptions.getScope() ); this.lockOptions.setTimeOut( lockOptions.getTimeOut() ); this.lockOptions.setFollowOnLocking( lockOptions.getFollowOnLocking() ); return this; }
Dialect dialect, List<AfterLoadAction> afterLoadActions) { if ( ( parameters.getLockOptions().getFollowOnLocking() == null && dialect.useFollowOnLocking( parameters ) ) || ( parameters.getLockOptions().getFollowOnLocking() != null && parameters.getLockOptions().getFollowOnLocking() ) ) {
if ( ( parameters.getLockOptions().getFollowOnLocking() == null && dialect.useFollowOnLocking( parameters ) ) || ( parameters.getLockOptions().getFollowOnLocking() != null && parameters.getLockOptions().getFollowOnLocking() ) ) { final LockMode lockMode = determineFollowOnLockMode( lockOptions ); if ( lockMode != LockMode.UPGRADE_SKIPLOCKED ) {
@Override public void cascade( EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled) { LOG.tracev( "Cascading to lock: {0}", entityName ); LockMode lockMode = LockMode.NONE; LockOptions lr = new LockOptions(); if ( anything instanceof LockOptions ) { LockOptions lockOptions = (LockOptions) anything; lr.setTimeOut( lockOptions.getTimeOut() ); lr.setScope( lockOptions.getScope() ); lr.setFollowOnLocking( lockOptions.getFollowOnLocking() ); if ( lockOptions.getScope() ) { lockMode = lockOptions.getLockMode(); } } lr.setLockMode( lockMode ); session.buildLockRequest( lr ).lock( entityName, child ); }
/** * Perform a shallow copy. * * @param source Source for the copy (copied from) * @param destination Destination for the copy (copied to) * * @return destination */ public static LockOptions copy(LockOptions source, LockOptions destination) { destination.setLockMode( source.getLockMode() ); destination.setScope( source.getScope() ); destination.setTimeOut( source.getTimeOut() ); if ( source.aliasSpecificLockModes != null ) { destination.aliasSpecificLockModes = new HashMap<String,LockMode>( source.aliasSpecificLockModes ); } destination.setFollowOnLocking( source.getFollowOnLocking() ); return destination; } }
@Override @SuppressWarnings("unchecked") public QueryImplementor setLockOptions(LockOptions lockOptions) { getQueryOptions().getLockOptions().setLockMode( lockOptions.getLockMode() ); getQueryOptions().getLockOptions().setScope( lockOptions.getScope() ); getQueryOptions().getLockOptions().setTimeOut( lockOptions.getTimeOut() ); getQueryOptions().getLockOptions().setFollowOnLocking( lockOptions.getFollowOnLocking() ); return this; }
@Override public void cascade( EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled) { LOG.tracev( "Cascading to lock: {0}", entityName ); LockMode lockMode = LockMode.NONE; LockOptions lr = new LockOptions(); if ( anything instanceof LockOptions ) { LockOptions lockOptions = (LockOptions) anything; lr.setTimeOut( lockOptions.getTimeOut() ); lr.setScope( lockOptions.getScope() ); lr.setFollowOnLocking( lockOptions.getFollowOnLocking() ); if ( lockOptions.getScope() ) { lockMode = lockOptions.getLockMode(); } } lr.setLockMode( lockMode ); session.buildLockRequest( lr ).lock( entityName, child ); }