protected static OObjectDatabaseTx getDatabase ( ) { ODatabaseInternal < ? > databaseOwner = ODatabaseRecordThreadLocal . instance ( ) . get ( ) . getDatabaseOwner ( ) ; if ( databaseOwner instanceof OObjectDatabaseTx ) { return ( OObjectDatabaseTx ) databaseOwner ; } else if ( databaseOwner instanceof ODatabaseDocumentInternal ) { return new OObjectDatabaseTx ( ( ODatabaseDocumentInternal ) databaseOwner ) ; } throw new IllegalStateException ( "Current database not of expected type" ) ; }
Gets the current thread database as a ODatabasePojoAbstract wrapping it where necessary .