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:it.geosdi.era.server.dao.hibernate.DAOUtenteProgettoHibernate.java
License:Open Source License
public void lock(UtenteProgetto entity) throws DAOException { try {/* w ww . j a v a2 s .c om*/ getSession().lock(entity, LockMode.UPGRADE); } catch (HibernateException ex) { throw new DAOException(ex); } }
From source file:it.geosdi.era.server.dao.hibernate.DAOViewport.java
License:Open Source License
public Viewport findById(Long id, boolean lock) throws DAOException { Viewport entity;/*from w ww . j a v a 2 s. c o m*/ try { if (lock) { entity = (Viewport) getSession().load(Viewport.class, id, LockMode.UPGRADE); } else { entity = (Viewport) getSession().load(Viewport.class, id); } } catch (HibernateException ex) { throw new DAOException(ex); } return entity; }
From source file:it.geosdi.era.server.dao.hibernate.DAOViewport.java
License:Open Source License
public void lock(Viewport entity) throws DAOException { try {//from w ww . j a v a2 s.co m getSession().lock(entity, LockMode.UPGRADE); } catch (HibernateException ex) { throw new DAOException(ex); } }
From source file:it.geosolutions.geobatch.ais.dao.hibernate.DAOAbstractSpring.java
License:Open Source License
@SuppressWarnings("unchecked") public T findById(ID id, boolean lock) throws DAOException { T entity;/*from www. j a va2 s .co m*/ try { if (lock) { entity = (T) getSession().load(getPersistentClass(), id, LockMode.UPGRADE); } else { entity = (T) getSession().load(getPersistentClass(), id); } } catch (HibernateException ex) { logger.fine(ex.getMessage()); throw new DAOException(ex); } return entity; }
From source file:it.geosolutions.geobatch.ais.dao.hibernate.DAOAbstractSpring.java
License:Open Source License
public void lock(T entity) throws DAOException { try {/*from ww w. j a v a 2 s . co m*/ getSession().lock(entity, LockMode.UPGRADE); } catch (HibernateException ex) { logger.fine(ex.getMessage()); throw new DAOException(ex); } }
From source file:it.geosolutions.geobatch.ftpserver.dao.hibernate.DAOAbstractSpring.java
License:Open Source License
@SuppressWarnings("unchecked") public T findById(ID id, boolean lock) throws DAOException { T entity;/*from ww w . j a v a 2s .com*/ try { if (lock) { entity = (T) getSession().load(getPersistentClass(), id, LockMode.UPGRADE); } else { entity = (T) getSession().load(getPersistentClass(), id); } } catch (HibernateException ex) { LOGGER.trace(ex.getMessage()); throw new DAOException(ex); } return entity; }
From source file:it.geosolutions.geobatch.ftpserver.dao.hibernate.DAOAbstractSpring.java
License:Open Source License
public void lock(T entity) throws DAOException { try {//from ww w.j a v a 2 s. com getSession().lock(entity, LockMode.UPGRADE); } catch (HibernateException ex) { LOGGER.trace(ex.getMessage()); throw new DAOException(ex); } }
From source file:itensil.repository.hibernate.RepositoryEntity.java
License:Open Source License
/** * * @param uri// w w w . j a v a 2 s . com * @return node object * @throws AccessDeniedException * @throws NotFoundException */ public MutableRepositoryNode getNodeByUri(String uri, boolean forUpdate) throws AccessDeniedException, NotFoundException { User caller = SecurityAssociation.getUser(); authorizedCheck(caller); String localUri = localizeUri(uri); Session session = HibernateUtil.getSession(); Query qry = session.getNamedQuery("Repo.getNodeByUri"); qry.setEntity("repo", this); qry.setString("uri", localUri); if (forUpdate) qry.setLockMode("node", LockMode.UPGRADE); NodeEntity node = (NodeEntity) qry.uniqueResult(); if (node == null) { if (!existingAncestorBlock(caller, localUri)) { throw new NotFoundException(uri); } else { throw new AccessDeniedException(uri, "read"); } } if (!hasPermission(caller, node, DefaultNodePermission.READ)) { throw new AccessDeniedException(uri, "read"); } node.setRepoEntity(this); return node; }
From source file:itensil.repository.hibernate.RepositoryEntity.java
License:Open Source License
/** * * @param nodeId//from ww w. j a va 2 s . co m * @return node object * @throws AccessDeniedException * @throws NotFoundException */ public MutableRepositoryNode getNode(String nodeId, boolean forUpdate) throws AccessDeniedException, NotFoundException { User caller = SecurityAssociation.getUser(); authorizedCheck(caller); Session session = HibernateUtil.getSession(); Query qry = session.getNamedQuery("Repo.getNode"); qry.setString("id", nodeId); qry.setEntity("repo", this); if (forUpdate) qry.setLockMode("node", LockMode.UPGRADE); NodeEntity node = (NodeEntity) qry.uniqueResult(); if (node == null) { throw new NotFoundException(nodeId); } if (!hasPermission(caller, node, DefaultNodePermission.READ)) { throw new AccessDeniedException(nodeId, "read"); } node.setRepoEntity(this); return node; }
From source file:itensil.workflow.activities.state.ActivityStateStore.java
License:Open Source License
public void activateToken(Activity token) throws StateException { getSession().lock(token, LockMode.UPGRADE); }