protected void configureOwningSide(Association association) { PersistentEntity associatedEntity = association.getAssociatedEntity(); if(associatedEntity == null) { association.setOwningSide(true); } else { if (association.isBidirectional()) { if (associatedEntity.isOwningEntity(association.getOwner())) { association.setOwningSide(true); } } else { if (association instanceof OneToOne) { if (associatedEntity.isOwningEntity(association.getOwner())) association.setOwningSide(true); } else if (!(association instanceof Basic)) { if (associatedEntity.isOwningEntity(association.getOwner())) { association.setOwningSide(true); } else { association.setOwningSide(false); } } } } }