You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2022/08/25 16:24:21 UTC
[isis] 08/09: ISIS-3179: catches PersistenceException thrown for application-defined composite PK for JPA and load-time weaving.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 6015ad2a2af75b2891a7f2d3b55147ae30799bbb
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Aug 25 17:20:31 2022 +0100
ISIS-3179: catches PersistenceException thrown for application-defined composite PK for JPA and load-time weaving.
---
.../isis/persistence/jpa/integration/entity/JpaEntityFacet.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/entity/JpaEntityFacet.java b/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/entity/JpaEntityFacet.java
index 5a64c89efc..cc2a15513f 100644
--- a/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/entity/JpaEntityFacet.java
+++ b/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/entity/JpaEntityFacet.java
@@ -276,7 +276,7 @@ public class JpaEntityFacet
return EntityState.PERSISTABLE_DETACHED; // an optimization, not strictly required
}
} catch (PersistenceException ex) {
- // horrible hack, but encountered NPEs if using a composite key (eg CommandLogEntry)
+ // horrible hack, but encountered NPEs if using a composite key (eg CommandLogEntry) (this was without any weaving)
Throwable cause = ex.getCause();
if (cause instanceof DescriptorException) {
DescriptorException descriptorException = (DescriptorException) cause;
@@ -285,6 +285,10 @@ public class JpaEntityFacet
return EntityState.PERSISTABLE_DETACHED;
}
}
+ if (cause instanceof NullPointerException) {
+ // horrible hack, encountered if using composite key (eg ExecutionLogEntry) with dynamic weaving
+ return EntityState.PERSISTABLE_DETACHED;
+ }
throw ex;
}