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 efce33304a ISIS-3208: fixes prev. commit
efce33304a is described below

commit efce33304a9f4f4c57ad23c8850b9f339e1c92d2
Author: Andi Huber <[email protected]>
AuthorDate: Wed Sep 14 12:30:51 2022 +0200

    ISIS-3208: fixes prev. commit
---
 .../apache/isis/persistence/jpa/integration/entity/JpaEntityFacet.java | 3 ++-
 1 file changed, 2 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 3767849c6d..0aa82be96b 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
@@ -253,9 +253,9 @@ public class JpaEntityFacet
         }
 
         val entityManager = getEntityManager();
-        val primaryKey = 
getPersistenceUnitUtil(entityManager).getIdentifier(pojo);
 
         if (entityManager.contains(pojo)) {
+            val primaryKey = 
getPersistenceUnitUtil(entityManager).getIdentifier(pojo);
             if (primaryKey == null) {
                 return EntityState.PERSISTABLE_ATTACHED_NO_OID;
             }
@@ -263,6 +263,7 @@ public class JpaEntityFacet
         }
 
         try {
+            val primaryKey = 
getPersistenceUnitUtil(entityManager).getIdentifier(pojo);
             if (primaryKey == null) {
                 return EntityState.PERSISTABLE_DETACHED;
             } else {

Reply via email to