Re: Create entity manager without cdi

2019-12-10 Thread Ivan Junckes Filho
CrVirtualDefis is pointing to a DataSource in tomee.xml. But I was able to workaround this using: CDI.current().select(d.getExporterClass()).get(); With this I am able to get a cdi instance. It was sufficient to make it work with @PersistenceContext. Thanks guys. On Tue, Dec 10, 2019 at 11:47

Re: Create entity manager without cdi

2019-12-10 Thread Jonathan Gallimore
What is "CrVirtualDefis" - that must be a resource you're referencing somewhere (persistence.xml?). What is it you're trying to do? Your stack trace passes with a stateless session bean, so you should have CDI available to you. Jon On Tue, Dec 10, 2019 at 1:18 PM Ivan Junckes Filho wrote: >

Re: Create entity manager without cdi

2019-12-10 Thread Daniel Cunha
Hi Ivan, @PersistenceContext(unitName="test_unit") and Persistence.createEntityManagerFactory("test_unit").createEntityManager(); is exactly the same thing. This will create your EntityManager from persistence.xml configuration. You need to remember to define the resource in you resources.xml or

Create entity manager without cdi

2019-12-10 Thread Ivan Junckes Filho
Hey guys, I am not being able to create the entity manager without CDI. I know @PersistenceContext works, but I can't use it. This code below doesn't work, can anyone help? Persistence.createEntityManagerFactory("test_unit").createEntityManager(); Error: