public DatabaseConfigVO getDBConfig() throws SQLException { return dbConnection.getDatabaseConfig(); }
public String getDbType() { return dbConnection.getType(); }
/** * Find out if this context is valid. Returns <code>false</code> if this * context has been aborted or completed. * * @return <code>true</code> if the context is still valid, otherwise * <code>false</code> */ public boolean isValid() { // Only return true if our DB connection is live return dbConnection != null && dbConnection.isTransActionAlive(); }
dbConnection.rollback(); } finally { try { if (!dbConnection.isSessionAlive()) { dbConnection.closeDBConnection();
/** * Reload an entity from the database into the cache. This method will return a reference to the "attached" * entity. This means changes to the entity will be tracked and persisted to the database. * * @param entity The entity to reload * @param <E> The class of the enity. The entity must implement the {@link ReloadableEntity} interface. * @return A (possibly) <b>NEW</b> reference to the entity that should be used for further processing. * @throws SQLException When reloading the entity from the database fails. */ @SuppressWarnings("unchecked") public <E extends ReloadableEntity> E reloadEntity(E entity) throws SQLException { return (E) dbConnection.reloadEntity(entity); }
/** * The Session used to manipulate entities of this type. * * @param context current DSpace context. * @return the current Session. * @throws SQLException */ protected Session getHibernateSession(Context context) throws SQLException { return ((Session) context.getDBConnection().getSession()); }
/** * Returns the size of the cache of all object that have been read from the database so far. A larger number * means that more memory is consumed by the cache. This also has a negative impact on the query performance. In * that case you should consider uncaching entities when they are no longer needed (see * {@link Context#uncacheEntity(ReloadableEntity)} () uncacheEntity}). * * @throws SQLException When connecting to the active cache fails. */ public long getCacheSize() throws SQLException { return this.getDBConnection().getCacheSize(); }
dbConnection.commit(); reloadContextBoundEntities();
if (dbConnection != null) { dbConnection.closeDBConnection(); dbConnection = null;
@Override protected void finalize() throws Throwable { /* * If a context is garbage-collected, we roll back and free up the * database connection if there is one. */ if (dbConnection != null && dbConnection.isTransActionAlive()) { abort(); } super.finalize(); }