从普通 Hibernate 配置迁移到 Hibernate Annotations - 数据库也需要 FK
目前我的项目有以下场景:
- 实现了 Hibernate 配置文件(xml)映射
- 数据库还没有任何 FK 关系
所以现在我想知道在从 hibernate xml 配置迁移到 hibernate 之前需要记住哪些事情注释。
我想在这里指定的另一件事是,现在我的数据库没有定义任何类型的 FK 关系...
所以显然我将首先应用 FK,然后开始迁移到注释...
在这种情况下任何人都可以有什么我应该遵循的具体建议吗?
提前致谢...
Currently I have following scenario with my project :
- Implemented Hibernate Configuration files (xml) mapping
- Database doesn't have any FK relationship yet
So Now I wanna know that what are the things I need to keep in mind before migrating from hibernate xml configuration to hibernate annotations.
One more thing I wanna specify here is right now with my db i don't have any kind of FK relationship defined....
So obviously I will be applying FK first and then start migrating to annotations...
With this scenario Can anybody have any specific suggestion that I should follow ?
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要非常小心。在我工作的地方,我们所做的一切都使用注释,因此据我预见,不应该有任何具体限制。
如果可能的话,一次迁移代码的一个逻辑块可能是明智的。但基本上,它只是费力地运行您的代码并将所有内容从 cofnig xml 复制到您的实体类。
Be very careful. Where I work we do everything with annotations so there shouldn't be any specific limitations as far as I can foretell.
It might be wise to migrate a logic chunk of your code at a time if at all possible. But basically it's just painstakingly running through your code and copying everything from the cofnig xml to your entity classes.