use of org.eclipse.kapua.commons.model.id.KapuaEid in project kapua by eclipse.
the class IdGeneratorServiceImpl method generate.
@Override
public KapuaId generate() throws KapuaException {
KapuaEid id = null;
EntityManager em = null;
try {
em = CommonsEntityManagerFactory.getEntityManager();
Query q = em.createNativeQuery(QUERY_SELECT_UUID_SHORT);
BigInteger bi = (BigInteger) q.getSingleResult();
id = new KapuaEid(bi);
} catch (Exception pe) {
throw new KapuaRuntimeException(KapuaCommonsErrorCodes.ID_GENERATION_ERROR, pe);
} finally {
if (em != null) {
em.close();
}
}
return id;
}
Aggregations