Query query = em.createNamedQuery("EntDbJnotab.findByKey");
query.setParameter("keys", keys);
try {
List<EntDbJnotab> list = query.getResultList();
if (list != null && list.size() > 0) {
EntDbJnotab entity = list.get(0);
nextValue = entity.getValue();
// after fetched next value, update new value
entity.setValue(entity.getValue() + allocateSize);
em.merge(entity);
}
} catch (Exception e) {
LOG.error("Cannot get next value by key.");
LOG.error("Exception: {}", e.getMessage());