You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Rafael Teixeira (JIRA)" <ji...@apache.org> on 2013/12/04 17:01:36 UTC

[jira] [Updated] (OPENJPA-2463) Wrong logging level on message issued by the fix to OPENJPA-2233

     [ https://issues.apache.org/jira/browse/OPENJPA-2463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rafael Teixeira updated OPENJPA-2463:
-------------------------------------

    Description: 
Patch for issue OPENJPA-2233 introduced a message when a Embeddable entity defines an ID property, which the Enhancer can't properly add a helper method (getIDOwningClass).

--- openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java	(revision 1325823)
+++ openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java	(working copy)
@@ -1150,6 +1150,11 @@
             if (_meta.hasAbstractPKField() == true) { 
                 addGetIDOwningClass();
             }
+            
+        	if (_meta.isEmbeddedOnly() 
+            		&& _meta.getIdentityType() == ClassMetaData.ID_APPLICATION) {
+            	_log.error(_loc.get("ID-field-in-embeddable-unsupported", _meta.toString()));
+            }
             addNewObjectIdInstanceMethod(true);
             addNewObjectIdInstanceMethod(false);

The problem is that this message is also emitted when inheriting from a MappedSuperClass, containing an Id field/property, which is a very common pattern. 

As the persistence engine of OpenJPA works perfectly with such a class hierarchy (and even the Enhancer with the complement of that patch just skips adding a call to the non-added helper method), it is pointless to alarm operations personnel with a message labeled and tagged as an error.

Therefore I suggest to log it as a warning, also editing the corresponding message text to better indicate that the Enhancer will simply not add/call the helper method, skipping a potential optimization.

  was:
Patch for issue OPENJPA-2233 introduced a message when a Embeddable entity defines an ID property, which the Enhancer can't properly add a helper method.

--- openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java	(revision 1325823)
+++ openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java	(working copy)
@@ -1150,6 +1150,11 @@
             if (_meta.hasAbstractPKField() == true) { 
                 addGetIDOwningClass();
             }
+            
+        	if (_meta.isEmbeddedOnly() 
+            		&& _meta.getIdentityType() == ClassMetaData.ID_APPLICATION) {
+            	_log.error(_loc.get("ID-field-in-embeddable-unsupported", _meta.toString()));
+            }
             addNewObjectIdInstanceMethod(true);
             addNewObjectIdInstanceMethod(false);

The problem is this message is also emitted when inheriting from a MappedSuperClass, which is perfectly normal to have an Id field/property. As OpenJPA works perfectly with such a class hierarchy (And even the Enhancer with the complement of that patch just skips adding a call to the non-added helper method), it is pointless to alarm operations personnel with a message labeled and tagged as an error.

Therefore I suggest to log it as a warning, also editing the corresponding message text to better indicate that the Enhancer will not add/call the helper method.


> Wrong logging level on message issued by the fix to OPENJPA-2233
> ----------------------------------------------------------------
>
>                 Key: OPENJPA-2463
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2463
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>         Environment: OpenJPA as bundled on WebSphere 8.5.5
>            Reporter: Rafael Teixeira
>            Priority: Minor
>              Labels: error-feedback
>
> Patch for issue OPENJPA-2233 introduced a message when a Embeddable entity defines an ID property, which the Enhancer can't properly add a helper method (getIDOwningClass).
> --- openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java	(revision 1325823)
> +++ openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java	(working copy)
> @@ -1150,6 +1150,11 @@
>              if (_meta.hasAbstractPKField() == true) { 
>                  addGetIDOwningClass();
>              }
> +            
> +        	if (_meta.isEmbeddedOnly() 
> +            		&& _meta.getIdentityType() == ClassMetaData.ID_APPLICATION) {
> +            	_log.error(_loc.get("ID-field-in-embeddable-unsupported", _meta.toString()));
> +            }
>              addNewObjectIdInstanceMethod(true);
>              addNewObjectIdInstanceMethod(false);
> The problem is that this message is also emitted when inheriting from a MappedSuperClass, containing an Id field/property, which is a very common pattern. 
> As the persistence engine of OpenJPA works perfectly with such a class hierarchy (and even the Enhancer with the complement of that patch just skips adding a call to the non-added helper method), it is pointless to alarm operations personnel with a message labeled and tagged as an error.
> Therefore I suggest to log it as a warning, also editing the corresponding message text to better indicate that the Enhancer will simply not add/call the helper method, skipping a potential optimization.



--
This message was sent by Atlassian JIRA
(v6.1#6144)