List of usage examples for org.hibernate LockMode UPGRADE
LockMode UPGRADE
To view the source code for org.hibernate LockMode UPGRADE.
Click Source Link
From source file:org.egov.dao.recoveries.TdsHibernateDAO.java
License:Open Source License
public Recovery findById(final Long id, final boolean lock) { session = getCurrentSession();// www.ja va 2s .c o m Recovery recovery; if (lock) recovery = (Recovery) session.load(Recovery.class, id, LockMode.UPGRADE); else recovery = (Recovery) session.load(Recovery.class, id); return recovery; }
From source file:org.fireflow.engine.modules.persistence.hibernate.ActivityInstancePersisterHibernateImpl.java
License:Open Source License
public void lockActivityInstance(String activityInstanceId) { this.getHibernateTemplate().get(ActivityInstanceImpl.class, activityInstanceId, LockMode.UPGRADE); }
From source file:org.fireflow.engine.persistence.hibernate.PersistenceServiceHibernateImpl.java
License:Open Source License
public void lockTaskInstance(String taskInstanceId) { this.getHibernateTemplate().get(TaskInstance.class, taskInstanceId, LockMode.UPGRADE); }
From source file:org.glite.security.voms.admin.integration.orgdb.dao.OrgDBGenericHibernateDAO.java
License:Apache License
@SuppressWarnings("unchecked") public T findById(ID id, boolean lock) { T entity;// w ww. j av a 2 s . com if (lock) entity = (T) getSession().get(getPersistentClass(), id, LockMode.UPGRADE); else entity = (T) getSession().get(getPersistentClass(), id); return entity; }
From source file:org.glite.security.voms.admin.persistence.dao.hibernate.GenericHibernateDAO.java
License:Apache License
@SuppressWarnings("unchecked") public T findById(ID id, boolean lock) { T entity;/*from w w w.j av a 2 s. c o m*/ if (lock) entity = (T) getSession().load(getPersistentClass(), id, LockMode.UPGRADE); else entity = (T) getSession().load(getPersistentClass(), id); return entity; }
From source file:org.glite.security.voms.admin.persistence.dao.hibernate.NotificationDAOHibernate.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from w w w .ja v a2 s. c o m public List<Notification> fetchJobs(int numJobs, String handlerId) { Validate.notNull(handlerId); Validate.isTrue(numJobs > 0, "numJobs must be a positive integer"); String fetchQuery = "from Notification n where n.status = 'QUEUED' and n.handlerId is null"; Query qq = getSession().createQuery(fetchQuery).setMaxResults(numJobs).setLockMode("n", LockMode.UPGRADE); return qq.list(); }
From source file:org.glite.security.voms.admin.persistence.dao.hibernate.TaskLockDAOHibernate.java
License:Apache License
private TaskLock findLock(String taskName) { return (TaskLock) getSession().createQuery(GET_LOCK_QUERY).setLockMode("t", LockMode.UPGRADE) .setTimeout(QUERY_TIMEOUT_IN_SECS).setString("taskName", taskName).uniqueResult(); }
From source file:org.grails.datastore.gorm.hibernate.HibernateSession.java
License:Apache License
@Override public void lock(Object o) { hibernateTemplate.lock(o, LockMode.UPGRADE); }
From source file:org.grails.datastore.gorm.hibernate.HibernateSession.java
License:Apache License
@Override public <T> T lock(Class<T> type, Serializable key) { return hibernateTemplate.get(type, key, LockMode.UPGRADE); }
From source file:org.hyperic.hibernate.id.HQMultipleHiLoPerTableGenerator.java
License:Open Source License
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { tableName = PropertiesHelper.getString(ID_TABLE, params, DEFAULT_TABLE); pkColumnName = PropertiesHelper.getString(PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN); valueColumnName = PropertiesHelper.getString(VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN); initialHi = PropertiesHelper.getInt(INITIAL_HI, params, DEFAULT_INITIAL_HI); String schemaName = params.getProperty(SCHEMA); String catalogName = params.getProperty(CATALOG); keySize = PropertiesHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH); keyValue = PropertiesHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE)); if (tableName.indexOf('.') < 0) { tableName = Table.qualify(catalogName, schemaName, tableName); }//from ww w . j a v a 2 s .co m query = "select " + valueColumnName + " from " + dialect.appendLockHint(LockMode.UPGRADE, tableName) + " where " + pkColumnName + " = '" + keyValue + "'" + dialect.getForUpdateString(); update = "update " + tableName + " set " + valueColumnName + " = ? where " + valueColumnName + " = ? and " + pkColumnName + " = '" + keyValue + "'"; insert = "insert into " + tableName + "(" + pkColumnName + ", " + valueColumnName + ") " + "values('" + keyValue + "', ?)"; // hilo config maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE); lo = maxLo + 1; // so we "clock over" on the first invocation returnClass = type.getReturnedClass(); }