Koitlin support for JPA static metamodel

When I create an Entity class using Java JPA static meta models are generated.

If I convert my Entities to Kotlin JPA static metamodels are not generated.

How to solve this problem?

EDIT

I am using Gradle as build tool.


I had to use kapt plugin.

I had to add following line to my build.gradle file.

kapt "org.hibernate:hibernate-jpamodelgen:${hibernate_version}"

When using Maven, add the following snippet to <executions> of kotlin-maven-plugin.

<execution>
   <id>kapt</id>
   <goals>
      <goal>kapt</goal>
   </goals>
   <configuration>
      <sourceDirs>
         <sourceDir>src/main/kotlin</sourceDir>
      </sourceDirs>
      <annotationProcessorPaths>
         <annotationProcessorPath>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <version>5.3.2.Final</version>
         </annotationProcessorPath>
      </annotationProcessorPaths>
   </configuration>
</execution>