I have a bunch of queries in my stalesssession bean that is called quite frequently. I am trying to resuse the query but I keep running into problems with transactions.
A method in my bean -
public List foo()
Query query = entityManger.createQuery(queryStr); -> This call takes quite a bit of time
-> If I declare the query as a memeber variable and initialize it in the @PostContruct method
-> the second time I run into a transaction issue. How can I avoid that?
-> My aim is to remove the calls to entityManager.createQuery to speed up the method and to reuse the query