Also I am using inheritance with @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) and this strategy is overwritten by the base class strategy resulting in tables for the abstract superclass that otherwise wouldn't exist.
I found out the hard way that using BaseClassStrategy and SubclassStrategy are null by default. This is not clear from the documentation; it even states that flat is the default strategy which I verified to be false: an appropriate strategy is selected based on configuration on the entities. Using these settings will ignore the individual settings in the entities and use the strategies for all entities. Lesson learned: don't mess with OpenJPA internals and be very careful with custom plugin strategies. -----Oorspronkelijk bericht----- Van: Henno Vermeulen [mailto:he...@huizemolenaar.nl] Verzonden: woensdag 24 april 2013 11:24 Aan: 'users@openjpa.apache.org' Onderwerp: RE: repeatable autogenerate names for key constraints Note that there is a serious bug in the code I included in the answer of my own question. I am using the BaseClassStrategy also for subclasses which affects what tables are generated for inheritance! To solve this you should use <property name="openjpa.jdbc.MappingDefaults" value="nl.hm.olga.core.dao.openjpa.KeyConstraintNamesMappingDefaults(ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict, BaseClassStrategy=org.apache.openjpa.jdbc.meta.strats.PrimaryKeyConstraintNameFullClassStrategy)" /> But this again results in non-predictable names for primary keys used in subclasses.