Xml 从XSD生成hibernate实体bean
我的要求是将大量XML值保存到数据库中。Xml 从XSD生成hibernate实体bean,xml,hibernate,jaxb,Xml,Hibernate,Jaxb,我的要求是将大量XML值保存到数据库中。 在分析了几个选项之后,我最终确定了从巨大的xml生成实体bean类,然后使用hibernate将其持久化的选项。我选择不创建hbm文件,而是使用hibernate注释。这样,我将使用JAXB从XSD生成Java类,并手动添加hibernate注释。 是否有任何eclipse插件或util框架可以从带有默认hibernate注释的XSD生成实体类?您可以使用HyperJAXB生成带有JPA注释的JAXB模型。Hibernate实现了JPA规范: 以下是
在分析了几个选项之后,我最终确定了从巨大的xml生成实体bean类,然后使用hibernate将其持久化的选项。
我选择不创建hbm文件,而是使用hibernate注释。这样,我将使用JAXB从XSD生成Java类,并手动添加hibernate注释。
是否有任何eclipse插件或util框架可以从带有默认hibernate注释的XSD生成实体类?您可以使用HyperJAXB生成带有JPA注释的JAXB模型。Hibernate实现了JPA规范:
- 以下是一些文档:
以下是我完成的一个项目的工作示例:
<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>
org.jvnet.jaxb2.maven2
maven-jaxb2-plugin
0.7.4
org.jvnet.hyperjaxb3
HyperJAXB3EJB插件
0.5.5
生成域1
生成
假的
account.xsd
customer.xsd
address.xsd
域绑定.xjb
真的
你的包裹在这里
${project.build.directory}/generated sources/jaxbandjpa
-山奈特
-Xhyperjaxb3 ejb
org.jvnet.jaxb2_commons
jaxb2基础知识
0.6.0
org.jvnet.jaxb2_commons
jaxb2基础注释
0.6.0
希望它有帮助我在谷歌搜索这个问题时找到了它,但不知道如何开始使用它,甚至无法下载它?