mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
Add evict method
This commit is contained in:
@@ -714,6 +714,12 @@ public class Context
|
||||
return (E) dbConnection.reloadEntity(entity);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <E extends ReloadableEntity> void uncacheEntity(E entity) throws SQLException {
|
||||
dbConnection.uncacheEntity(entity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reload all entities related to this context.
|
||||
* @throws SQLException When reloading one of the entities fails.
|
||||
|
@@ -53,4 +53,6 @@ public interface DBConnection<T> {
|
||||
* @param entity The DSpace object to reload
|
||||
*/
|
||||
public <E extends ReloadableEntity> E reloadEntity(E entity) throws SQLException;
|
||||
|
||||
public <E extends ReloadableEntity> void uncacheEntity(E entity) throws SQLException ;
|
||||
}
|
@@ -157,4 +157,9 @@ public class HibernateDBConnection implements DBConnection<Session> {
|
||||
getSession().setFlushMode(FlushMode.AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends ReloadableEntity> void uncacheEntity(E entity) throws SQLException {
|
||||
getSession().evict(entity);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user