如何从数据库生成 Hibernate 映射文件
我既有用于创建数据库的模式,也有数据库本身。
我想知道是否存在可以为架构中指定的实体创建 Hibernate 映射的工具。
我更喜欢使用该工具生成带有注释的对象文件,但如果这是不可能的,那么我将不得不接受 XML 注释。
我知道 Hibernate Code Generation
是 JBoss 工具的一部分,但我无法配置它来生成注释。
有人对如何进行有任何建议吗?
I have both a schema that served in the creation of my database, as well as the database itself.
I'm wondering if there exists any tool that can create a Hibernate mapping for the entities specified in the schema.
My preference would be for the tool to generate Object files with annotations, but if that is impossible, then I will have to accept XML annotations.
I am aware of Hibernate Code Generation
that is part of JBoss tools, but I haven't been able to configure it to generate annotations.
Does anyone have any advice on how to proceed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过“Hibernate代码生成”,你的意思是逆向工程工具?这是我所知道的从 Hibernate 数据库模式生成内容的唯一方法。我不认为有一个从模式到带注释的类的单步解决方案,但是如果您使用逆向工程工具生成 XML 映射文件,那么您可以使用 POJO 导出器 从 XML 生成带注释的类。
By "Hibernate Code Generation", do you mean the reverse engineering tool? That's the only thing I know of for generating things from a database schema for Hibernate. I don't think there's a single-step solution to go from schema to annotated classes, but if you use the reverse engineering tool to generate XML mapping files, you could then use the POJO exporter to generate annotated classes from the XML.