private void addEntity ( DbEntity entity , boolean recovering ) throws DatabaseEngineException { if ( ! recovering ) { try { getConnection ( ) ; } catch ( final Exception e ) { throw new DatabaseEngineException ( "Could not add entity" , e ) ; } validateEntity ( entity ) ; if ( entities . containsKey ( entity . getName ( ) ) ) { throw new DatabaseEngineException ( String . format ( "Entity '%s' is already defined" , entity . getName ( ) ) ) ; } if ( this . properties . isSchemaPolicyDropCreate ( ) ) { dropEntity ( entity ) ; } } if ( ! this . properties . isSchemaPolicyNone ( ) ) { createTable ( entity ) ; addPrimaryKey ( entity ) ; addFks ( entity ) ; addIndexes ( entity ) ; addSequences ( entity ) ; } loadEntity ( entity ) ; }
Adds an entity to the engine . It will create tables and everything necessary so persistence can work .