Example usage for javax.persistence LockModeType NONE

List of usage examples for javax.persistence LockModeType NONE

Introduction

In this page you can find the example usage for javax.persistence LockModeType NONE.

Prototype

LockModeType NONE

To view the source code for javax.persistence LockModeType NONE.

Click Source Link

Document

No lock.

Usage

From source file:com.confighub.core.store.Store.java

public List<UserAccount> getSystemAdmins() throws ConfigException {
    try {//from   w ww  . jav a 2s  .  c  o  m
        return em.createNamedQuery("Users.sysAdmins").setLockMode(LockModeType.NONE).getResultList();
    } catch (NoResultException e) {
        return Collections.EMPTY_LIST;
    } catch (Exception e) {
        handleException(e);
        return Collections.EMPTY_LIST;
    }
}

From source file:com.confighub.core.store.Store.java

public Map<String, SystemConfig> getSystemConfig(final SystemConfig.ConfigGroup group) throws ConfigException {
    try {//w  w  w  .  j  a v a 2  s .  c o  m
        List<SystemConfig> list = em.createNamedQuery("SysConfig.byGroup").setLockMode(LockModeType.NONE)
                .setParameter("groupName", group).getResultList();

        Map<String, SystemConfig> map = new HashMap<>();
        list.forEach(e -> map.put(e.getKey(), e));

        return map;
    } catch (NoResultException e) {
        return Collections.EMPTY_MAP;
    } catch (Exception e) {
        handleException(e);
        return Collections.EMPTY_MAP;
    }
}

From source file:com.confighub.core.store.Store.java

public SystemConfig getSystemConfig(final SystemConfig.ConfigGroup group, final String key)
        throws ConfigException {
    try {//from  w ww .j a  v a  2s .c o m
        return (SystemConfig) em.createNamedQuery("SysConfig.byKey").setLockMode(LockModeType.NONE)
                .setParameter("groupName", group).setParameter("key", key).getSingleResult();
    } catch (NoResultException e) {
        return null;
    } catch (Exception e) {
        handleException(e);
        return null;
    }
}