From the documentation:
However, with a simple mapping:
An insert query for discount_code_uses is still executed for every persist. My entity is part of an inheritance tree using @Inheritance(JOINED) which may contribute to the problem.
After some investigation I found out that Join#isInverse() is only handled in the SingleTableEntityPersister, and not the UnionSubclassPersister or JoinedSubclassPersister. So this issue is related to the used inheritance strategy. I'll change the title accordingly.
I have submitted a pull request for supporting inverse secondary tables on the JoinedSubclassEntityPersister. While trying to apply these changes to the UnionSubclassPersister as well, I found out that SecondaryTables are not supported there altogether, for which I've created a separate issue ().