public boolean isRefInverse ( Reference ref ) { if ( ref . isInverse ( ) ) { return true ; } if ( ! ref . isInverse ( ) && ( ref . getOpposite ( ) != null ) && ref . getOpposite ( ) . isInverse ( ) ) { return false ; } if ( ref . getOpposite ( ) == null ) { return false ; } // inverse not defined on any side, use this algorithm String name1 = ref . getTo ( ) . getName ( ) ; String name2 = ref . getFrom ( ) . getName ( ) ; // use a well defined algorithm, like alphabetic order // A -> B inverse=false // B -> A inverse= true return ( name1 . compareTo ( name2 ) < 0 ) ; }
Inverse attribute for many - to - many associations .