Example usage for org.springframework.transaction.annotation Isolation READ_COMMITTED

List of usage examples for org.springframework.transaction.annotation Isolation READ_COMMITTED

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Isolation READ_COMMITTED.

Prototype

Isolation READ_COMMITTED

To view the source code for org.springframework.transaction.annotation Isolation READ_COMMITTED.

Click Source Link

Document

A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.

Usage

From source file:com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, isolation = Isolation.READ_COMMITTED)
public void copyResources(ExecutionContext context, final String[] resources, final String destinationFolder) {
    initTempNameResources();//from   w w w.j  av a 2 s. c om
    try {
        executeWriteCallback(new DaoCallback() {
            public Object execute() {
                copyResources(resources, destinationFolder);
                return null;
            }
        });
    } finally {
        resetTempNameResources();
    }
}

From source file:com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, isolation = Isolation.READ_COMMITTED)
public Folder copyFolder(ExecutionContext context, final String sourceURI, final String destinationURI) {
    initTempNameResources();/*from w  w  w .ja va2s.c  o m*/
    auditFolderCopyAndMove("copyFolder", sourceURI, destinationURI);
    try {
        Folder copy = (Folder) executeWriteCallback(new DaoCallback() {
            public Object execute() {
                RepoFolder folderCopy = copyFolder(sourceURI, destinationURI);
                return folderCopy.toClient();
            }
        });
        closeAuditEvent("copyFolder");
        return copy;
    } finally {
        resetTempNameResources();
    }
}

From source file:org.qifu.base.service.BaseService.java

@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public DefaultResult<T> findObjectByOid(T object) throws ServiceException, Exception {
    if (object == null || !(object instanceof BaseValueObj)) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }/*from w ww  . j av  a  2  s. c o  m*/
    Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0);
    Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
    E entityObject = entityObjectClass.newInstance();
    T objectByOid = null;
    try {
        this.doMapper(object, entityObject, this.getMapperIdVo2Po());
        E entityByOid = this.findByOid(entityObject);
        if (entityByOid != null) {
            objectByOid = valueObjectClass.newInstance();
            this.doMapper(entityByOid, objectByOid, this.getMapperIdPo2Vo());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    DefaultResult<T> result = new DefaultResult<T>();
    if (objectByOid != null && !StringUtils.isBlank(((BaseValueObj) objectByOid).getOid())) {
        result.setValue(objectByOid);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(SysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}

From source file:org.qifu.base.service.BaseService.java

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
@SuppressWarnings("unchecked")
public DefaultResult<T> findByUK(T object) throws ServiceException, Exception {
    if (object == null || !(object instanceof BaseValueObj)) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }//from   w w  w  .  j av  a  2s  . c  o m
    Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0);
    Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
    E entityObject = entityObjectClass.newInstance();
    T objectByUK = null;
    try {
        this.doMapper(object, entityObject, this.getMapperIdVo2Po());
        E entityByUK = this.getBaseDataAccessObject().findByUK(entityObject);
        if (entityByUK != null) {
            objectByUK = valueObjectClass.newInstance();
            this.doMapper(entityByUK, objectByUK, this.getMapperIdPo2Vo());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    DefaultResult<T> result = new DefaultResult<T>();
    if (objectByUK != null && !StringUtils.isBlank(((BaseValueObj) objectByUK).getOid())) {
        result.setValue(objectByUK);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(SysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}

From source file:org.qifu.base.service.BaseService.java

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
@SuppressWarnings("unchecked")
public int countByUK(T object) throws ServiceException, Exception {
    if (object == null || !(object instanceof BaseValueObj)) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }//from  w  w w. jav  a2s  .  c  om
    int count = 0;
    Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
    E entityObject = entityObjectClass.newInstance();
    try {
        this.doMapper(object, entityObject, this.getMapperIdVo2Po());
        count = this.getBaseDataAccessObject().countByUK(entityObject);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return count;
}

From source file:org.qifu.base.service.SimpleService.java

@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public DefaultResult<E> findEntityByOid(E object) throws ServiceException, Exception {
    if (object == null || !(object instanceof BaseEntity)) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }//from   w w  w .j  a v a  2 s  .  c  o  m
    DefaultResult<E> result = new DefaultResult<E>();
    try {
        E entityObject = this.findByOid(object);
        if (entityObject != null && !StringUtils.isBlank(((BaseEntity<String>) entityObject).getOid())) {
            result.setValue(entityObject);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (result.getValue() == null) {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(SysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}

From source file:org.qifu.base.service.SimpleService.java

@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public E findByOid(E entityObject) throws ServiceException, Exception {
    if (entityObject == null || !(entityObject instanceof BaseEntity)) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }/*from w  w  w  .j  a v  a  2 s  .  co m*/
    if (StringUtils.isBlank(((BaseEntity<String>) entityObject).getOid())) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.DATA_NO_EXIST));
    }
    return this.getBaseDataAccessObject().findByOid(entityObject);
}

From source file:org.qifu.base.service.SimpleService.java

@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public int countByOid(E entityObject) throws ServiceException, Exception {
    if (entityObject == null || !(entityObject instanceof BaseEntity)) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }//from   w w  w .jav  a2s .c o  m
    if (StringUtils.isBlank(((BaseEntity<String>) entityObject).getOid())) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.DATA_NO_EXIST));
    }
    return this.getBaseDataAccessObject().countByOid(entityObject);
}

From source file:org.qifu.base.service.SimpleService.java

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public E findByPK(String pk) throws ServiceException, Exception {
    if (pk == null) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }/*from   w  ww .  j av a  2 s  . com*/
    return this.getBaseDataAccessObject().findByPK(pk);
}

From source file:org.qifu.base.service.SimpleService.java

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public int countByPK(String pk) throws ServiceException, Exception {
    if (pk == null) {
        throw new ServiceException(SysMessageUtil.get(SysMsgConstants.OBJ_NULL));
    }/*from  w  w w. j a va 2 s  .c o  m*/
    return this.getBaseDataAccessObject().countByPK(pk);
}