mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 21:13:19 +00:00
DS-3660: Fix discovery reindex on metadata change
Stored objects may get evicted from the session cache and get into detached state. Lazy loaded fields are inaccessible and throw an exception on access. Before using objects they have to be reloaded (retrieved from the database and associated with the session again).
This commit is contained in:

committed by
Tim Donohue

parent
342f190231
commit
388558792c
@@ -160,11 +160,12 @@ public class IndexEventConsumer implements Consumer {
|
||||
if (objectsToUpdate != null && handlesToDelete != null) {
|
||||
|
||||
// update the changed Items not deleted because they were on create list
|
||||
for (DSpaceObject iu : objectsToUpdate) {
|
||||
for (DSpaceObject o : objectsToUpdate) {
|
||||
/* we let all types through here and
|
||||
* allow the search indexer to make
|
||||
* decisions on indexing and/or removal
|
||||
*/
|
||||
DSpaceObject iu = ctx.reloadEntity(o);
|
||||
String hdl = iu.getHandle();
|
||||
if (hdl != null && !handlesToDelete.contains(hdl)) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user