Re: JtaEntityManager GC

2018-02-20 Thread Matthew Broadhead
sorry i misread the question.  you should still be able to @Inject into a @Stateless without a @RequestContext? for my timer classes i used this example http://tomee.apache.org/examples-trunk/schedule-expression/README.html an @EJB @Singleton initialised with TimerConfig On 19/02/2018 21:43,

Re: JtaEntityManager GC

2018-02-20 Thread Matthew Broadhead
you might be able to use a @Qualifier to have 2 different producers On 19/02/2018 21:43, cocorossello wrote: Thx Chongma, but one question. Let's say I also want to use that MyRepo1 from a @Stateless @Scheduled (so no request context). How can I produce that same entityManager? -- Sent

Re: JtaEntityManager GC

2018-02-19 Thread Romain Manni-Bucau
it was supposed to be done on leaf call on the dsl Romain Manni-Bucau @rmannibucau | Blog | Old Blog | Github | LinkedIn

Re: JtaEntityManager GC

2018-02-19 Thread cocorossello
Romain, one question. You said that if I was using it outside a transaction I should clear myself the entityManager. But looking at the JtaEntityManager it does nothing in that case: public void clear() { if (!extended && !isTransactionActive()) { return; }

Re: JtaEntityManager GC

2018-02-19 Thread cocorossello
Thx Chongma, but one question. Let's say I also want to use that MyRepo1 from a @Stateless @Scheduled (so no request context). How can I produce that same entityManager? -- Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: JtaEntityManager GC

2018-02-15 Thread Matthew Broadhead
i was told to inject the entitymanager like this @ApplicationScoped public class EntityManagerProducer {     @PersistenceUnit(unitName = "myDb")     private EntityManagerFactory entityManagerFactory;     @Produces     @Default     @RequestScoped     public EntityManager create() {         return

Re: JtaEntityManager GC

2018-02-13 Thread Romain Manni-Bucau
tomee closes the EM after the transaction, if you need to call clear() it means the close doesnt release the data in your provider - can be a bug. In terms of pattern you need to clear it when you don't need it anymore. A way to do it is a Synchronization and register it in the transaction

Re: JtaEntityManager GC

2018-02-13 Thread cocorossello
Hi, Calling entityManager.clear() seems the best approach since most of the queries are not executed inside a transaction. But I have no idea on where I should use it or what would be a good implementation pattern. I mean, let's say I have a @ViewScoped with a couple of injected

Re: JtaEntityManager GC

2018-02-08 Thread Romain Manni-Bucau
With Eclipselink take care it can trigger some unexpected connection if you use without willing it lazy fetching (in a view for instance). This is an easy way to leak :(. Romain Manni-Bucau @rmannibucau | Blog | Old Blog

Re: JtaEntityManager GC

2018-02-08 Thread cocorossello
My xmx is 11g right now, I need it this way or production environment will end up doing full gc. The heapdump is taken after a GC. I think the problem comes from eclipselink. We have some caches. Those caches are storing some entities which are in fact storing lazy relations. In case of a

Re: JtaEntityManager GC

2018-02-07 Thread Paul Carter-Brown
What is your xmx setting and did you force a gc prior to taking the heap dump? On your db have you checked if there are any long running transactions On 7 Feb 2018 5:44 pm, "cocorossello" wrote: > Hi, > > We are having some memory problems in our applications. We are

Re: JtaEntityManager GC

2018-02-07 Thread Romain Manni-Bucau
Hi, normally they are garbaged collected once the transaction ends. If you use it without transaction you can need to call clear() once you are done. Romain Manni-Bucau @rmannibucau | Blog | Old Blog

JtaEntityManager GC

2018-02-07 Thread cocorossello
Hi, We are having some memory problems in our applications. We are using tomee 7.0.4 with eclipselink, no second cache level. Most of the application are @ApplicationScoped. Transaction is managed by container (JTA), no extended transactions at all, everything we do with persistence is through