File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate metamodel generator does not generate metamodel for classes outside the module Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate metamodel generator does not generate metamodel for classes outside the module" Watch "Hibernate metamodel generator does not generate metamodel for classes outside the module" New topic
Author

Hibernate metamodel generator does not generate metamodel for classes outside the module

Grzegorz Gy
Greenhorn

Joined: Apr 26, 2014
Posts: 1
Hello,

I've got the following configuration:

Project A,B and C which depends on A and B. In module A there are no JPA mappings. In module B and C there are annotation-based JPA mappings. In module C there are also xml-based mappings for classes in project A. The module C contains standard persistence.xml and orm.xml files which list out all xml-based mappings and entity classes from every module.

I use the following maven configuration to generate the metamodel:

<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>generate jpa metamodel sources</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<debug>true</debug>
<outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
<processors>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</processors>
<debug>true</debug>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>4.3.5.Final</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>

What it turns out is that the metamodel is generated but only for the classes mapped by xml mappings or those mapped by annotation-based mapping but only in module C. No metamodel is generated for classes in module B. Except for that everything works fine (tables are generated etc.) for all classes. So there's something wrong only with metamodel generation.

How to explain such behavior?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate metamodel generator does not generate metamodel for classes outside the module