RE: JPA best practices webinar

Have your compared the persitence.xml in demo project
to yours. Also check that you have
in your project in correct place.

i was watching
JPA Best Practices Webinar

I’ve downloaded the code in
Git Hub jpa-addressbook

It works fine!!
But when i try to do something similar i’ve got the next error

WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can’t find a persistence unit named ‘crediantialsdb’ in deployment test-jpa-0.0.1-SNAPSHOT.war for injection point public javax.persistence.EntityManager pfc.vaadin.test_jpa.backend.CdiConfig.entityManager

persistence.xml is in src/main/resources/META-INF

In the video and in the comments persistence.xml say




Something escape me!!

OK i found the problem with the name of the unitName.
I lost a little s :frowning:

  • (credentialsdb in producer field of the EntityManager)
  • (credentialdb when inject the EntityManager)

Now the problem is other.
I load the data in a method in the class service with @PostConstruct annotation and i inject the service in a form that it’s created in the init of the UI.

I can’t see the table created in the console, so the first time that i use service instance throws nullpointerexceptio.

I don’t understand, i thought that when you inject the server create the instance of the service and after that invoke the PostConstruct method. But in my case seems doing nothing.


I create a @PostConstruct method in the UI to load the data