/// <summary> /// Lock /// </summary> /// <param name="entity"></param> /// <param name="lockMode"></param> public void Lock(object entity, NHibernate.LockMode lockMode) { if (!this.IsOpen) { throw new InvalidOperationException("Repository must be open before an entity can be saved or updated."); } _session.Lock(entity, lockMode); }
public override string AppendLockHint(LockMode lockMode, string tableName) { if (lockMode.Equals(LockMode.UpgradeNoWait)) { return tableName + " with (updlock, rowlock, readpast)"; } return base.AppendLockHint(lockMode, tableName); }
public void Refresh(object item, NHibernate.LockMode lockMode) { try { NHibernateHttpModule.CurrentSession.Refresh(item, lockMode); } catch {} }
public LoadByTypeHibernateCallback(Type entityType, object id, LockMode lockMode) { this.entityType = entityType; this.id = id; this.lockMode = lockMode; }
public void Lock(object id, object version, object obj, LockMode lockMode, ISessionImplementor session) {}
public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session) { return null; }
public void SetLockMode(string alias, LockMode lockMode) { if (string.IsNullOrEmpty(alias)) throw new ArgumentNullException("alias", "Is null or empty."); lockModes[alias] = lockMode; }
/// <summary> /// Update the given persistent instance. /// Obtains the specified lock mode if the instance exists, implicitly /// checking whether the corresponding database entry still exists /// (throwing an OptimisticLockingFailureException if not found). /// </summary> /// <param name="entity">The persistent instance to update.</param> /// <param name="lockMode">The lock mode to obtain.</param> /// <exception cref="DataAccessException">In case of Hibernate errors</exception> public void Update(object entity, LockMode lockMode) { Execute(new UpdateObjectHibernateCallback(this, entity, lockMode), true); }
/// <summary> /// Re-read the state of the given persistent instance. /// Obtains the specified lock mode for the instance. /// </summary> /// <param name="entity">The persistent instance to re-read.</param> /// <param name="lockMode">The lock mode to obtain.</param> /// <exception cref="DataAccessException">In case of Hibernate errors</exception> public void Refresh(object entity, LockMode lockMode) { Execute(new RefreshHibernateCallback(entity, lockMode), true); }
/// <summary> /// Return the persistent instance of the given entity type /// with the given identifier, or <code>null</code> if not found. /// Obtains the specified lock mode if the instance exists. /// </summary> /// <param name="type">The type.</param> /// <param name="id">The lock mode to obtain.</param> /// <param name="lockMode">The lock mode.</param> /// the persistent instance, or <code>null</code> if not found /// <returns>the persistent instance, or null if not found</returns> /// <exception cref="DataAccessException">In case of Hibernate errors</exception> public object Get(Type type, object id, LockMode lockMode) { return Execute(new GetByTypeHibernateCallback(type, id, lockMode), true); }
public void Lock(Object object_Renamed, LockMode lockMode) { try { _session.Lock(object_Renamed, lockMode); } catch (Exception t) { HandleDatabaseException(t, "load(" + object_Renamed + "," + lockMode + ")"); } }
public Object Load(Type theClass, Int64 id, LockMode lockMode) { Object o = null; try { o = _session.Load(theClass, id, lockMode); } catch (ObjectNotFoundException e) { throw new ObjectNotFoundException(theClass, "id=" + id.ToString() + " Exception:" + e.Message); } catch (Exception t) { HandleDatabaseException(t, "load(" + theClass.FullName + "," + id.ToString() + "," + lockMode + ")"); } return o; }
public void Lock(object id, object version, object obj, LockMode lockMode, ISessionImplementor session) { throw new NotImplementedException(); }
public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session) { throw new NotImplementedException(); }
private LockingHints(LockMode lockingHintAnalog) { LockingModeAnalog = lockingHintAnalog; }
public RefreshHibernateCallback(object entity, LockMode lockMode) { this.entity = entity; this.lockMode = lockMode; }
public UpdateObjectHibernateCallback(HibernateTemplate template, object entity, LockMode lockMode) { this.outer = template; this.entity = entity; this.lockMode = lockMode; }
public void SetLockMode(string alias, LockMode lockMode) { _lockHints[alias] = lockMode; }
/// <summary> /// Return the persistent instance of the given entity class /// with the given identifier, throwing an exception if not found. /// Obtains the specified lock mode if the instance exists. /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="id">An identifier of the persistent instance.</param> /// <param name="lockMode">The lock mode.</param> /// <returns>The persistent instance</returns> /// <exception cref="ObjectRetrievalFailureException">If not found</exception> /// <exception cref="DataAccessException">In case of Hibernate errors</exception> public object Load(Type entityType, object id, LockMode lockMode) { return Execute(new LoadByTypeHibernateCallback(entityType, id, lockMode), true); }
public bool Equals(LockMode other) { if (other == null) { return false; } if (ReferenceEquals(this, other)) { return true; } return other.level == level && Equals(other.name, name); }
/// <summary> /// Obtain the specified lock level upon the given object, implicitly /// checking whether the corresponding database entry still exists /// (throwing an OptimisticLockingFailureException if not found). /// </summary> /// <param name="entity">The he persistent instance to lock.</param> /// <param name="lockMode">The lock mode to obtain.</param> /// <exception cref="ObjectOptimisticLockingFailureException">If not found</exception> /// <exception cref="DataAccessException">In case of Hibernate errors</exception> public void Lock(object entity, LockMode lockMode) { Execute(new LockHibernateCallback(entity, lockMode), true); }
/// <summary> /// Is this lock mode more restrictive than the given lock mode? /// </summary> /// <param name="mode"></param> public bool GreaterThan(LockMode mode) { return level > mode.level; }
/// <summary> /// Delete the given persistent instance. /// </summary> /// <param name="entity">The persistent instance to delete.</param> /// <param name="lockMode">The lock mode to obtain.</param> /// <remarks> /// Obtains the specified lock mode if the instance exists, implicitly /// checking whether the corresponding database entry still exists /// (throwing an OptimisticLockingFailureException if not found). /// </remarks> /// <exception cref="DataAccessException">In case of Hibernate errors</exception> public void Delete(object entity, LockMode lockMode) { Execute(new DeleteLockModeHibernateCallback(this, entity, lockMode), true); }
/// <summary> /// Is this lock mode less restrictive than the given lock mode? /// </summary> /// <param name="mode"></param> public bool LessThan(LockMode mode) { return level < mode.level; }