Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Grzegorz Gy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic