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 2021/12/06 08:51:41 UTC

[isis] branch master updated: ISIS-2911: remove JDO choice provider issue workaround

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 a5a7301  ISIS-2911: remove JDO choice provider issue workaround
a5a7301 is described below

commit a5a7301734a159fe8ae2ff533d7167c50d309223
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Dec 6 09:51:35 2021 +0100

    ISIS-2911: remove JDO choice provider issue workaround
    
    - workaround makes things worse
---
 .../metamodel/facets/entity/JdoEntityFacet.java           | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/metamodel/facets/entity/JdoEntityFacet.java b/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/metamodel/facets/entity/JdoEntityFacet.java
index e13ed72..d21bfc3 100644
--- a/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/metamodel/facets/entity/JdoEntityFacet.java
+++ b/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/metamodel/facets/entity/JdoEntityFacet.java
@@ -44,6 +44,8 @@ import org.apache.isis.commons.internal.assertions._Assert;
 import org.apache.isis.commons.internal.base._NullSafe;
 import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.commons.internal.collections._Maps;
+import org.apache.isis.commons.internal.debug._Debug;
+import org.apache.isis.commons.internal.debug.xray.XrayUi;
 import org.apache.isis.commons.internal.exceptions._Exceptions;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
@@ -107,12 +109,17 @@ implements EntityFacet {
         val pm = getPersistenceManager();
         var primaryKey = pm.getObjectId(pojo);
 
-        if(primaryKey==null) {
-            pm.makePersistent(pojo);
-            primaryKey = pm.getObjectId(pojo);
-        }
+//        if(primaryKey==null) {
+//            pm.makePersistent(pojo);
+//            primaryKey = pm.getObjectId(pojo);
+//        }
 
         if(primaryKey==null) {
+
+            _Debug.onCondition(XrayUi.isXrayEnabled(), ()->{
+                _Debug.log(10, "detached entity detected %s", pojo);
+            });
+
             throw _Exceptions.illegalArgument(
                     "The persistence layer does not recognize given object of type %s, "
                     + "meaning the object has no identifier that associates it with the persistence layer. "