I am using the Maven plugin for JAXB to create classes from an XML schema document. My POM contains the following
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <goals> <goal>xjc</goal> </goals> <phase>generate-sources</phase> </execution> </executions> <configuration> <clearOutputDir>false</clearOutputDir> <outputDirectory>src/main/java</outputDirectory> <schemaDirectory>src/main/webapp/schemas</schemaDirectory> <includeSchema>**/*.xsd</includeSchema> <bindingDirectory>src/main/resources/bindings</bindingDirectory> <enableIntrospection>false</enableIntrospection> </configuration> </plugin>
I use the Eclipselink specification for JPA 2. When JAXB generates a class according to the schema, it does not include the following annotations.
@Entity @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
Right now, I just add them manually every time I do a clean compilation with Maven. I am wondering, is there anyway for the JAXB plugin to annotate the class file with these annotations included when it generates classes?
Barry source share