Thursday, August 19, 2010

I used to like Cascades

Oooch! Ooooch! Oooooch! Hibernate is being a pain to grasp for me :'( .... Actually, at least in this case, the JPA/Hibernate combo was the one kicking my rear this time. Turns out that there are two "flavors" of CascadeTypes: JPA's and Hibernate's. Oh!, and don't you dare ignoring the Hibernate ones if you are using it as your persistence "back-end' :-P


I cannot thank mkyong enough for saving me from spending many more hours digging around and "experimenting" to solve foreign key constraint issues with his post on Cascade – JPA & Hibernate annotation common mistake. I have just one comment to add to what he posted: for the Hibernate CascadeType to "kick in", I still needed to specify the JPA one in my entity. Per Hibernate's documentation on cascading this is recommended, but in my case it seems to be actually required :|

No comments:

Post a Comment