Author: curtisr7 Date: Tue Dec 17 02:33:28 2013 New Revision: 1551447 URL: http://svn.apache.org/r1551447 Log: OPENJPA-2233: Merge changes from trunk.
Added: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestEmbeddableEntityWithIDAnnotation.java - copied unchanged from r1551446, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestEmbeddableEntityWithIDAnnotation.java openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/EmbeddableEntityWithIDAnnotation.java - copied unchanged from r1551446, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/EmbeddableEntityWithIDAnnotation.java openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/IDOwningClassTestEntity.java - copied unchanged from r1551446, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/IDOwningClassTestEntity.java Modified: openjpa/branches/2.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java openjpa/branches/2.3.x/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties Modified: openjpa/branches/2.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?rev=1551447&r1=1551446&r2=1551447&view=diff ============================================================================== --- openjpa/branches/2.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java (original) +++ openjpa/branches/2.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java Tue Dec 17 02:33:28 2013 @@ -1179,6 +1179,11 @@ public class PCEnhancer { 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); } @@ -2747,13 +2752,12 @@ public class PCEnhancer { // new <oid class> (); code.anew().setType(oidType); code.dup(); - if (_meta.isOpenJPAIdentity() || (obj && usesClsString == - Boolean.TRUE)) { - if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField() == true ) { + if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE)) { + if ((_meta.isEmbeddedOnly() && ! (_meta.getIdentityType() == ClassMetaData.ID_APPLICATION)) + || _meta.hasAbstractPKField() == true ) { code.aload().setThis(); - code.invokevirtual().setMethod(PRE + "GetIDOwningClass", - Class.class, null); - }else { + code.invokevirtual().setMethod(PRE + "GetIDOwningClass", Class.class, null); + } else { code.classconstant().setClass(getType(_meta)); } } Modified: openjpa/branches/2.3.x/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties?rev=1551447&r1=1551446&r2=1551447&view=diff ============================================================================== --- openjpa/branches/2.3.x/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties (original) +++ openjpa/branches/2.3.x/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties Tue Dec 17 02:33:28 2013 @@ -220,3 +220,4 @@ set-method: Error while setting value {2 down-level-enhanced-entity: The Entity "{0}" was enhanced at level "{1}", but the current level of enhancement is \ "{2}". static-asm-exception: Encountered an unexpected exception while loading ASM. +ID-field-in-embeddable-unsupported: The identity field defined in the {0} Embeddable is not supported.