Search code examples
javadatabaseopenjpa

Why does OpenJPA not store foreign keys by default?


By default OpenJPA does not create foreign keys for database tables, which surprised me. The official statement on the "why" does not even touch upon the why, it simply explains what to do in order to change the default setup. I know there is a performance penalty for constraint checking, but is it only me thinking that clean structure should supersede performance in a default setup? Does someone know more about the why? I could not find any more official statements.


Solution

  • I stumbled upon a similar issue related to foreign key constraint handling in OpenJPA. Please have a look at the OpenJPA forum discussion about it. Kevin Sutter has some answers. Maybe they satisfy your need for more information.