public static Triple < String , String , String > buildIndexes ( final GeneratedTypeElement entity , boolean unique , int counter ) { Triple < String , String , String > result = new Triple <> ( ) ; result . value0 = "" ; result . value1 = "" ; result . value2 = "" ; List < String > indexes = entity . index ; String uniqueString ; uniqueString = "UNIQUE " ; if ( indexes == null || indexes . size ( ) == 0 ) return result ; List < String > listCreateIndex = new ArrayList <> ( ) ; List < String > listDropIndex = new ArrayList <> ( ) ; for ( String index : indexes ) { String createIndex = String . format ( " CREATE %sINDEX idx_%s_%s on %s (%s)" , uniqueString , entity . getTableName ( ) , counter ++ , entity . getTableName ( ) , index ) ; String dropIndex = String . format ( " DROP INDEX IF EXISTS idx_%s_%s" , entity . getTableName ( ) , counter ) ; listCreateIndex . add ( createIndex ) ; listDropIndex . add ( dropIndex ) ; } result . value0 = StringUtils . join ( listCreateIndex , ";" ) ; result . value1 = StringUtils . join ( listDropIndex , ";" ) ; return result ; }
A generated element can have only a primary key and two FK .