generating metamodel

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

generating metamodel

Matthew Broadhead
i want to try CriteriaBuilder for constructing queries.

i am sure i used to generate the canonical metamodel classes
automatically by adding a parameter to the persistence.xml but i cannot
find anything on the mailing list or in the docs.  i have found
instructions for generating the classes on the command line
https://openjpa.apache.org/builds/2.4.2/apache-openjpa/docs/ch13s04.html 
and some mentions of using maven on the mailing list.  it seems a long
winded way of generating the model.

does anyone know how to get them generating automatically in the project?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: generating metamodel

Matthew Broadhead
i fixed it with
https://rmannibucau.wordpress.com/2013/01/24/enhancing-openjpa-classes-with-maven-maven-compiler-alternative/

<plugin>
                 <groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
                 <version>2.1.0</version>
                 <executions>
                     <execution>
                         <id>process</id>
                         <goals>
                             <goal>process</goal>
                         </goals>
                         <phase>generate-sources</phase>
                         <configuration>
<compilerArguments>-Aopenjpa.source=8
-Aopenjpa.metamodel=true</compilerArguments>
                             <processors>
<processor>org.apache.openjpa.persistence.meta.AnnotationProcessor8</processor>
                             </processors>
<outputDirectory>target/generated-sources/metamodel</outputDirectory>
                         </configuration>
                     </execution>
                 </executions>
                 <!-- <dependencies> <dependency>
<groupId>org.apache.openjpa</groupId>
                     <artifactId>openjpa</artifactId>
<version>${openjpa.version}</version> </dependency>
                     </dependencies> -->
             </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
                 <version>1.7</version>
                 <executions>
                     <execution>
                         <id>add-source</id>
                         <phase>generate-sources</phase>
                         <goals>
                             <goal>add-source</goal>
                         </goals>
                         <configuration>
                             <sources>
<source>target/generated-sources/metamodel</source>
                             </sources>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>

but if anyone knows a better way please let  me know

On 21/07/2017 09:18, Matthew Broadhead wrote:

> i want to try CriteriaBuilder for constructing queries.
>
> i am sure i used to generate the canonical metamodel classes
> automatically by adding a parameter to the persistence.xml but i
> cannot find anything on the mailing list or in the docs.  i have found
> instructions for generating the classes on the command line
> https://openjpa.apache.org/builds/2.4.2/apache-openjpa/docs/ch13s04.html 
> and some mentions of using maven on the mailing list.  it seems a long
> winded way of generating the model.
>
> does anyone know how to get them generating automatically in the project?

Loading...