You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/10/27 13:10:44 UTC
[isis] branch master updated: ISIS-3265: detect non attached entity at post-load
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 51ebc83b53 ISIS-3265: detect non attached entity at post-load
51ebc83b53 is described below
commit 51ebc83b533aa99501b4bce2b3826a6bda55f07c
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Oct 27 15:10:34 2022 +0200
ISIS-3265: detect non attached entity at post-load
- and instead of going into a nested fetch loop ignore the event
- strange JPA specific issue
---
.../persistence/jpa/applib/integration/CausewayEntityListener.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/persistence/jpa/applib/src/main/java/org/apache/causeway/persistence/jpa/applib/integration/CausewayEntityListener.java b/persistence/jpa/applib/src/main/java/org/apache/causeway/persistence/jpa/applib/integration/CausewayEntityListener.java
index fa1a8708f6..13c4f4716d 100644
--- a/persistence/jpa/applib/src/main/java/org/apache/causeway/persistence/jpa/applib/integration/CausewayEntityListener.java
+++ b/persistence/jpa/applib/src/main/java/org/apache/causeway/persistence/jpa/applib/integration/CausewayEntityListener.java
@@ -76,6 +76,13 @@ public class CausewayEntityListener {
@PostLoad void onPostLoad(final Object entityPojo) {
log.debug("onPostLoad: {}", entityPojo);
val entity = objectManager.adapt(entityPojo);
+
+ val entityState = entity.getEntityState();
+ if(!entityState.isAttached()) {
+ log.error("onPostLoad event while pojo not attached ({}); ignoring the event",
+ entityState.name());
+ return;
+ }
objectLifecyclePublisher.onPostLoad(entity);
}