public String getTableAMultiplicity ( ) { String ret = "many" ; List < ColumnInfo > tableAPKs = tableA . getPkList ( ) ; if ( tableAPKs . size ( ) == 0 || tableA . getTableName ( ) . equals ( tableB . getTableName ( ) ) ) { return ret ; } if ( tableAB == null ) { List < ColumnInfo > fkColumns = this . getColumns ( ) ; Set < ColumnInfo > columnSet = new HashSet < ColumnInfo > ( ) ; columnSet . addAll ( fkColumns ) ; columnSet . removeAll ( tableAPKs ) ; if ( fkColumns . size ( ) == tableAPKs . size ( ) && columnSet . isEmpty ( ) ) { ret = "one" ; return ret ; } } for ( ForeignKey tableBFK : tableB . getForeignKeys ( ) . values ( ) ) { if ( ! tableBFK . getTableB ( ) . getTableName ( ) . equals ( tableA . getTableName ( ) ) ) continue ; List < ColumnInfo > tableBRefCols = tableBFK . getRefColumns ( ) ; Set < ColumnInfo > columns = new HashSet < ColumnInfo > ( ) ; columns . addAll ( tableBRefCols ) ; columns . removeAll ( tableAPKs ) ; if ( columns . isEmpty ( ) ) { ret = "one" ; break ; } } return ret ; }
Otherwise it is a 1 - 1 relationship .