JPA/Hibernate mapping error when entities are located in multiple JAR files?

Bernate config file requires all the entities to be referenced relative to its path, so in my opinion you cannot have entities separated out in different jars.

Problem resolved, and you can (fortunately) have entities separated out in different jars. – jruillier May 31 at 9:04.

Have you used the jar-file tag in your persistence. Xml configuration file? According to the JPA 2.0 Specification 8.2.1.6.3 One or more JAR files may be specified using the jar-file elements instead of, or in addition to the mapping files specified in the mapping-file elements.

If specified, these JAR files will be searched for managed persistence classes, and any mapping metadata annotations found on them will be processed, or they will be mapped using the mapping annotation defaults defined by this specification. Such JAR files are specified relative to the directory or jar file that contains82 the root of the persistence unit.83 The following examples illustrate the use of the jar-file element to reference additional persistence classes. These examples use the convention that a jar file with a name terminating in “PUnit�

Contains the persistence. Xml file and that a jar file with a name terminating in “Entities� Contains additional persistence classes.

App. Ear lib/earEntities. Jar earRootPUnit.

Jar (with META-INF/persistence. Xml ) persistence. Xml contains: lib/earEntities.

Jar You can see further examples in the spec. I hope that helps.

I've been trying with the 'jar-file' tag or with the 'class' tag, same result. Precision: other entities from 'JAR B' are successfully mapped. – jruillier May 25 at 12:48 @jruillier Are you explicitly listing your entities in the persistence.

Xml file? Do you have the exclude-unlisted-classes tag set to true? – edalorzo May 25 at 13:32 yes and yes!

– jruillier May 25 at 14:19 @jruillier Ok, Are the classes in your jar B (which you say are not being discovered by bernate) located in the list of entities in your persistence. Xml file? – edalorzo May 25 at 15:36 yes :).

The problem was linked to a maven dependency misconfiguration. Thanks for your answer. – jruillier May 257 at 9:06.

Sorry guys, the problem was something else... thanks for your answers.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions