-
1. Re: errai JPA: entity types empty
jfuerth Apr 10, 2014 9:48 AM (in response to michael_jank)1 of 1 people found this helpfulHi Michael,
It looks like you've done everything correctly, so I'm at a bit of a loss. Some things you can check:
1. Try the Errai JPA demo apps: errai/errai-demos/errai-jpa-demo-basic at master · errai/errai · GitHub and errai/errai-demos/errai-jpa-demo-todo-list at master · errai/errai · GitHub and ensure they work in your environment. If so, compare your app's setup to these demos.
2. Are you certain that ErraiEntityManagerGenerator is running at rebind time? I can't see why not, since you are inheriting its GWT module, but worth checking in the Dev Mode console log...
3. Enable DEBUG logging for org.jboss.errai.jpa at rebind time, and ensure it's seeing your entities during its scan (see log4j.properties and pom.xml in one of the JPA demo apps for clues on the configuration).
4. Run Dev Mode in debug (mvn gwt:debug), attach your IDE, and set a breakpoint in ErraiEntityManagerGenerator.createHibernateEntityManagerFactory(), paying special attention to how it builds the "managedTypeNames" list. Every type added to this list should be available in the client-side ErraiMetamodel.
Hope that helps!
-
2. Re: errai JPA: entity types empty
jfuerth Apr 10, 2014 11:22 AM (in response to jfuerth)Something else to try before the other stuff: it's possible that your entity classes have some non-translatable code in them, and this is making them invisible in the GWT TypeOracle. To check this, set up your GWT build for strict mode (-strict as a command line parameter, or <strict>true</strict> in gwt-maven-plugin configuration) and run a full production-mode build. (note that strict mode has no effect on Dev Mode; you have to do a full compile).
-Jonathan
-
3. Re: errai JPA: entity types empty
werrenmi Apr 11, 2014 2:46 AM (in response to michael_jank)Hello
Another hint can be maybe the validation messages during the compilation. You have to ensure, thats the JPA annotations are reachable by the GWT compiler (when the entities are in a separate Maven module for instance). When they are not reachable, this classes are may removed silently. As Jonathan already mentioned, try to see the problem with DEBUG.
Regards
Michel
-
4. Re: errai JPA: entity types empty
michael_jank Apr 11, 2014 8:51 AM (in response to werrenmi)Hi Jonathan and Michel,
thank you for your quick responses!
What I should mention is that I work with gradle. I debugged a bit the scanning of the classes and the ErraiEntityManagerGenerator, what I found is that my entity class is not scanned by MetadataScanner but ErraiEntityManagerGenerator.createHibernateEntityManagerFactory is called.
When building the project with maven and start mvn:debug, the scanning by MetadataScanner happens before creating the EntityManagerFactory, so things work fine. Therefore I think I missed something when configuring and starting the gwt compiler/devMode with gradle. But I am still working on this.
Cheers,
Michael
-
5. Re: errai JPA: entity types empty
michael_jank Apr 11, 2014 9:37 AM (in response to michael_jank)Also tried a bit playing with the system variable errai.reflections.cache, when starting in dev mode, setting it to true helps, and the test entity is written into the cache file. But in a normal assemble (no devmode) the test entity is missing in the cache file.
-
6. Re: errai JPA: entity types empty
werrenmi Apr 12, 2014 1:06 AM (in response to michael_jank)Sorry, i am not really familiar with gradle. Can you attach your project?
-
7. Re: errai JPA: entity types empty
michael_jank Apr 14, 2014 3:44 PM (in response to werrenmi)The problem was that when copying together the files during the build, some resource files were missing in this stage of the build, especially the ErraiApp.properties. As soon as the resource files were included correctly soon enough, the MetadataScanner of course found the entities.
We are now also using the gwt gradle plugin, so that's now one obvious error less to make...
Thanks for all your help, Jonathan and Michel!