具有基类的 Hibernate 逆向工程
我试图让 Hibernate Tools(和 Hibernate 3)通过以下方式生成我的 java 域代码:
com.example.model.base -> (ex TableBase.java)
com.example.model -> (ex Table.java)
其中 TableBase.java 是生成的类,而 Table 扩展了 TableBase。另外,如果 Table.java 已存在,则重新生成过程不应覆盖它。
因为我希望能够将我自己的访问器方法添加到 Table.java,并将自动生成的 TableBase.java 保留在它自己的包中,以便我可以随时重新生成。
到目前为止,在我的搜索中,我认为我需要创建自己的逆向工程策略。到目前为止我发现的文档在这方面很糟糕。我真正知道的是,我应该创建一个扩展 DelegatingReverseEngineeringStrategy 的类,并实现 tableToMetaAttribute 以将“Base”添加到我的基类的名称中。
不用说,到目前为止我还没有运气。希望有人能为我阐明这一点!
I'm trying to get Hibernate Tools (and Hibernate 3) to generate my java domain code in the following way:
com.example.model.base -> (ex TableBase.java)
com.example.model -> (ex Table.java)
Where TableBase.java is the generated class, and Table extends TableBase. Also, if Table.java already exists, the regeneration process should not overwrite it.
Since i want to be able to add my own accessor methods to Table.java, and leave the auto-generated TableBase.java in it's own package so i can regenerate at any time.
So far in my searching around I think i need to create my own Reverse Engineering Strategy. The documentation i've found so far is horrible in this area. All I really know is that I should create a class that extends DelegatingReverseEngineeringStrategy, and implement tableToMetaAttribute to add the "Base" to the name of my base classes.
Needless to say I haven't had any luck with it so far. Hope someone can shed some light on this for me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论