Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<Client> getClients()
- {
- List<Client> clist = new ArrayList<Client>();
- entityManager =entityManagerFactory.createEntityManager();
- try
- {
- clist = entityManager.createQuery("from Client").getResultList();
- return clist;
- }
- catch (Exception e)
- {
- }
- finally
- {
- entityManager.close()
- }
- }
- @PersistenceContext
- private EntityManager entityManager;
- public List<Client> getClients()
- {
- List<Client> clist = new ArrayList<Client>();
- try
- {
- clist = entityManager.createQuery("from
- Client").getResultList();
- return clist;
- }
- catch (Exception e)
- {
- LOGGER.error(e.getMessage());
- LOGGER.error(e.getStackTrace());
- return clist;
- }
- }
- @Transactional
- public void addNotification(Notifications noti)
- {
- try
- {
- getEntityManager().getTransaction().begin();
- getEntityManager().persist(noti);
- getEntityManager().getTransaction().commit();
- // getEntityManager().persist(noti);
- }
- catch (Exception e)
- {
- LOGGER.error(e.getMessage());
- LOGGER.error(e.getStackTrace());
- }
- finally
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement