コード例 #1
0
 @Override
 public Firma findById(long id) {
   entityManager = HibernateUtil.getEntityManager();
   Firma result = entityManager.find(Firma.class, id);
   entityManager.close();
   return result;
 }
コード例 #2
0
 @SuppressWarnings("unchecked")
 @Override
 public List<Firma> getAll() {
   entityManager = HibernateUtil.getEntityManager();
   List<Firma> result = entityManager.createQuery("from Firma").getResultList();
   entityManager.close();
   return result;
 }
コード例 #3
0
 @SuppressWarnings("unchecked")
 public List<Firma> findByFirmenName(String firmenName) {
   entityManager = HibernateUtil.getEntityManager();
   Query query = entityManager.createQuery("from Firma f where f.firmenName = :firmenname");
   List<Firma> result = query.setParameter("firmenname", firmenName).getResultList();
   entityManager.close();
   return result;
 }
コード例 #4
0
 public Firma findByFirmenName(String firmenName, String ansprechpartner) {
   entityManager = HibernateUtil.getEntityManager();
   Query query =
       entityManager.createQuery(
           "from Firma f where f.firmenName = :firmenname and f.ansprechpartner = :ansprechpartner");
   query.setParameter("firmenname", firmenName);
   Firma result = (Firma) query.setParameter("ansprechpartner", ansprechpartner).getSingleResult();
   entityManager.close();
   return result;
 }