public boolean checkTableExists(TableDefinition table){
  String column=null;
  for (  FieldDefinition field : table.getFields()) {
    if (column == null) {
      column=field.getName();
    }
 else     if (field.isPrimaryKey()) {
      column=field.getName();
      break;
    }
  }
  String sql="SELECT " + column + " FROM "+ table.getFullName()+ " WHERE "+ column+ " <> "+ column;
  DataReadQuery query=new DataReadQuery(sql);
  query.setMaxRows(1);
  try {
    session.executeQuery(query);
    return true;
  }
 catch (  Exception notFound) {
    return false;
  }
 finally {
  }
}

public boolean checkTableExists ( TableDefinition table ) { String column = null ; for ( FieldDefinition field : table . getFields ( ) ) { if ( column == null ) { column = field . getName ( ) ; } else if ( field . isPrimaryKey ( ) ) { column = field . getName ( ) ; break ; } } String sql = "SELECT " + column + " FROM " + table . getFullName ( ) + " WHERE " + column + " <> " + column ; DataReadQuery query = new DataReadQuery ( sql ) ; query . setMaxRows ( 1 ) ; try { session . executeQuery ( query ) ; return true ; } catch ( Exception notFound ) { return false ; } finally { } }
check if the table exists by issuing a select .
