My requirement is to save a huge XML values to database.
After analyzing few options I finalized that generate entity bean classes from huge xml and then persist it using hibernate.
I am opting out of creating hbm files and going for hibernate annotations.In this way I will be generating Java classes from XSD using JAXB and them manually add hibernate annotations.
Is there any eclipse plugin or util framework which can generate entity classes from XSD with default hibernate annotations?
Here's some documentation:
http://confluence.highsource.org/display/HJ3/Making+schema-derived+classes+ready+for+JPA
http://java.net/projects/hyperjaxb
Here's a working example for a project I have completed:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.4</version>
<dependencies>
<dependency>
<groupId>org.jvnet.hyperjaxb3</groupId>
<artifactId>hyperjaxb3-ejb-plugin</artifactId>
<version>0.5.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-domain1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<strict>false</strict>
<schemaIncludes>
<value>account.xsd</value>
<value>customer.xsd</value>
<value>address.xsd</value>
</schemaIncludes>
<bindingIncludes>
<include>domain-bindings.xjb</include>
</bindingIncludes>
<extension>true</extension>
<generatePackage>your.package.here</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/jaxbandjpa</generateDirectory>
<args>
<arg>-Xannotate</arg>
<arg>-Xhyperjaxb3-ejb</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.0</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With