List of usage examples for org.hibernate Session lock
void lock(Object object, LockMode lockMode);
From source file:org.opengoss.dao.hibernate.DataAccessor.java
License:Apache License
public void lock(final Object entity, final LockMode lockMode) throws DaoException { execute(new IAccessorCallback() { public Object call(Session session) throws HibernateException { session.lock(entity, lockMode); return null; }/*from ww w . j ava 2 s .co m*/ }); }
From source file:org.opengoss.dao.hibernate.DataAccessor.java
License:Apache License
public void update(final Object entity, final LockMode lockMode) throws DaoException { execute(new IAccessorCallback() { public Object call(Session session) throws HibernateException { session.update(entity);/* ww w. j ava 2 s .c om*/ if (lockMode != null) { session.lock(entity, lockMode); } return null; } }); }
From source file:org.opengoss.dao.hibernate.DataAccessor.java
License:Apache License
public void update(final String entityName, final Object entity, final LockMode lockMode) throws DaoException { execute(new IAccessorCallback() { public Object call(Session session) throws HibernateException { session.update(entityName, entity); if (lockMode != null) { session.lock(entity, lockMode); }/*from w w w. j a va 2 s . c om*/ return null; } }); }
From source file:org.opengoss.dao.hibernate.DataAccessor.java
License:Apache License
public void delete(final Object entity, final LockMode lockMode) throws DaoException { execute(new IAccessorCallback() { public Object call(Session session) throws HibernateException { if (lockMode != null) { session.lock(entity, lockMode); }/*from w w w. j a v a 2 s . c o m*/ session.delete(entity); return null; } }); }
From source file:org.rebioma.server.services.OccurrenceDbImpl.java
License:Apache License
public void attachClean(Session session, Occurrence instance) { log.debug("attaching clean Occurrence instance"); try {/* w w w . j av a2 s .co m*/ // ManagedSession.createNewSessionAndTransaction().lock(instance, LockMode.NONE); session.lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } }
From source file:org.springframework.orm.hibernate3.HibernateTemplate.java
License:Apache License
@Override public void lock(final Object entity, final LockMode lockMode) throws DataAccessException { executeWithNativeSession(new HibernateCallback<Object>() { @Override/*w w w. j av a 2 s . com*/ public Object doInHibernate(Session session) throws HibernateException { session.lock(entity, lockMode); return null; } }); }
From source file:org.springframework.orm.hibernate3.HibernateTemplate.java
License:Apache License
@Override public void update(final Object entity, final LockMode lockMode) throws DataAccessException { executeWithNativeSession(new HibernateCallback<Object>() { @Override// w w w. j a v a 2 s. c o m public Object doInHibernate(Session session) throws HibernateException { checkWriteOperationAllowed(session); session.update(entity); if (lockMode != null) { session.lock(entity, lockMode); } return null; } }); }
From source file:org.springframework.orm.hibernate3.HibernateTemplate.java
License:Apache License
@Override public void update(final String entityName, final Object entity, final LockMode lockMode) throws DataAccessException { executeWithNativeSession(new HibernateCallback<Object>() { @Override/*from w w w.j av a2 s. c o m*/ public Object doInHibernate(Session session) throws HibernateException { checkWriteOperationAllowed(session); session.update(entityName, entity); if (lockMode != null) { session.lock(entity, lockMode); } return null; } }); }
From source file:org.springframework.orm.hibernate3.HibernateTemplate.java
License:Apache License
@Override public void delete(final Object entity, final LockMode lockMode) throws DataAccessException { executeWithNativeSession(new HibernateCallback<Object>() { @Override//from w w w . j av a 2 s . c om public Object doInHibernate(Session session) throws HibernateException { checkWriteOperationAllowed(session); if (lockMode != null) { session.lock(entity, lockMode); } session.delete(entity); return null; } }); }
From source file:org.springframework.orm.hibernate3.StatelessHibernateTemplate.java
License:Apache License
public void lock(final Object entity, final LockMode lockMode) throws DataAccessException { execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { session.lock(entity, lockMode); return null; }//from ww w .j a v a2 s . c o m }, true); }