public static OgmCollectionPersister getInverseCollectionPersister ( OgmCollectionPersister mainSidePersister ) { if ( mainSidePersister . isInverse ( ) || ! mainSidePersister . isManyToMany ( ) || ! mainSidePersister . getElementType ( ) . isEntityType ( ) ) { return null ; } EntityPersister inverseSidePersister = mainSidePersister . getElementPersister ( ) ; // process collection-typed properties of inverse side and try to find association back to main side for ( Type type : inverseSidePersister . getPropertyTypes ( ) ) { if ( type . isCollectionType ( ) ) { OgmCollectionPersister inverseCollectionPersister = getPersister ( mainSidePersister . getFactory ( ) , ( CollectionType ) type ) ; if ( isCollectionMatching ( mainSidePersister , inverseCollectionPersister ) ) { return inverseCollectionPersister ; } } } return null ; }
Returns the given collection persister for the inverse side in case the given persister represents the main side of a bi - directional many - to - many association .