How can I troubleshoot JPA join annotation problems?

213 views Asked by At

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.

2

There are 2 answers

0
jpkroehling On BEST ANSWER

There are two official resources:

  1. 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.

  2. 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.

0
Eduard On

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.