@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
 @Override
 public String findNameById(Integer id) {
   final Query query =
       entityManager.createQuery("SELECT a.name FROM ServiceData a WHERE a.id=:id");
   query.setParameter("id", id);
   return (String) QueryResultWrapper.getSingleResult(query);
 }
 @Override
 public ServiceData findByName(String name) {
   final Query query = entityManager.createQuery("SELECT a FROM ServiceData a WHERE a.name=:name");
   query.setParameter("name", name);
   return (ServiceData) QueryResultWrapper.getSingleResult(query);
 }
Esempio n. 3
0
 /**
  * @throws javax.persistence.NonUniqueResultException if more than one entity with the name exists
  * @return the found entity instance or null if the entity does not exist
  */
 public static UserDataSourceData findByName(EntityManager entityManager, String name) {
   final Query query =
       entityManager.createQuery("SELECT a FROM UserDataSourceData a WHERE a.name=:name");
   query.setParameter("name", name);
   return (UserDataSourceData) QueryResultWrapper.getSingleResult(query);
 }