|
|
|
|
|
by robfig
5324 days ago
|
|
Yep, you figured it out. JPA requires you to set it on both sides. (Well, really you only HAVE to set it on the owning side of the association, which is what Hibernate monitors, but you should do both. Otherwise, a future programmer may be surprised that the objects don't have a consistent view of the association later on. |
|
I implemented my own ORM (http://joist.ws) a few years ago to solve this and my other JPA/Hibernate annoyances. It works really well, modulo the fact that I suck at docs/promotion/etc. so it doesn't have many users (working on that).
Also note that, specific for the playframework, someone seems to have implemented the necessary magic in a plugin:
http://www.playframework.org/modules/associations
Which is nifty, other than I'm slightly wary of the "magic that happens via runtime class rewriting" that seems to be Play's standard way of doing things. The results are admittedly impressive, but it seems like you're coupling yourself to yet-another-runtime-environment/container for things to work right.