private String getSchema ( ) { StringBuilder sb = new StringBuilder ( ) ; Iterator < TableColumn > iterator = columns . iterator ( ) ; while ( iterator . hasNext ( ) ) { TableColumn column = iterator . next ( ) ; if ( column . isOneToMany ( ) ) { if ( ! iterator . hasNext ( ) ) { // remove the extra ", " after one to many int length = sb . length ( ) ; sb . replace ( length - 2 , length , "" ) ; } continue ; } sb . append ( column ) ; if ( iterator . hasNext ( ) ) { sb . append ( ", " ) ; } } // writes out id_missing for logging, the actual idMissing check happens // by the annotation processor. String idCol = idColumn == null ? "id_missing" : idColumn . getColumnName ( ) ; return String . format ( CREATE_TABLE_DEFAULT , getTableName ( ) , idCol , sb . toString ( ) ) ; }
Get table schema