如何解决 JPA 连接注释问题?
JPA 连接注释对于使用 JPA 至关重要,但我发现找到关于它们的良好、深入的文档具有挑战性。
我的典型经验是,我认为某些东西正在工作,然后 3 天后,我注意到一个导致问题的场景,我花了几个小时/几天的时间来弄清楚我需要删除/添加参数/注释到我的一个实体。
有谁知道关于 JPA 连接注释的精彩、全面的指南吗?我厌倦了 JPA 是黑魔法的感觉。
The JPA join annotations are essential to using JPA but I find it challenging to find good, in-depth documentation about them.
My typical experience is I think something is working and then 3 days later I notice a scenario that causes a problem and I spend hours/days figuring out that I need to remove/add a parameter/annotation to one of my entities.
Does anyone know a great, comprehensive guide to the JPA join annotations? I'm sick of feeling like JPA is black magic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有两个官方资源:
JPA JavaDoc: http://download.oracle.com/javaee/5/api/index.html?javax/persistence/package-summary.html 。请参阅“注释类型摘要”部分。它列出了属于 JPA API 的所有注释以及一些描述。
JPA JSR 文档。 http://jcp.org/aboutJava/communityprocess/final/jsr220/ 。这是 JPA 的官方规范。阅读可能很无聊,但这是最好的官方资源。我相信每个程序员都应该阅读 JSR,特别是 JPA,因为它是他们日常工作的一部分。
但我也喜欢查看 Hibernate 测试套件。尽管它不是“官方 JPA”文档,但它提供了大量用例,几乎总是与我们的常规用例相匹配。我想说,如果您熟悉 javadoc、JSR 并且能够轻松地从 Hibernate 测试套件中获取参考资料,那么您就已经准备好处理边缘情况了。
There are two official resources:
JPA JavaDoc: http://download.oracle.com/javaee/5/api/index.html?javax/persistence/package-summary.html . Look at the section "Annotation Types Summary". It lists all annotations which are part of the JPA API, as well as some description.
JPA JSR documentation. http://jcp.org/aboutJava/communityprocess/final/jsr220/ . This is the official specification for the JPA. The reading may be boring, but it's the best official resource for it. I believe that every programmer should read JSR's, specially the JPA, when it's part of their daily jobs.
But I also like to look at the Hibernate test suite. Even though it's not "official JPA" documentation, it provides a big set of use cases, which almost always matches our regular use cases. I'd say that if you are familiar with the javadoc, the JSR and comfortable in taking references from the Hibernate test suite, you are prepared to deal with edge cases.
我通常会查看官方文档。我发现注释类型摘要非常有帮助。
此处还有相当不错的 JPA 教程。我从来不需要任何其他的。
I usually look into official docs. I find annotation types sumary very helpful.
There is also pretty decent tutorial on JPA here. I Have never needed any other.