Inserting logic in persistency JUnit test to prevent duplicates in many-to-one/one-to-many relationships.