Community
Participate
Working Groups
When initializing the metamodel and an Attribute field cannot be found on the canonical model class the initialization fails with a ValidationException wrapping the FieldNotFoundException. I propose that an Attribute in the Metamodel not being found in the canonical metamodel class should be ignored during initialization. The canonical model is used at design time to build criteria queries so it missing at runtime has little effect. The following patch ignores this case and also makes the getMapping() public on AttributeImpl so that the mapping can be accessed externally through the metamodel downcasting. Index: src/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java =================================================================== --- src/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java (revision 9393) +++ src/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java (working copy) @@ -2531,8 +2531,9 @@ } else { PrivilegedAccessHelper.getDeclaredField(clazz, fieldName, false).set(clazz, attribute); } - } - catch (Exception e) { + } catch (NoSuchFieldException nsfe) { + // Ignore fields missing in canonical model + } catch (Exception e) { ValidationException v = ValidationException.invalidFieldForClass(fieldName, clazz); v.setInternalException(e); throw v; Index: src/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java =================================================================== --- src/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java (revision 9393) +++ src/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java (working copy) @@ -207,7 +207,7 @@ * Return the databaseMapping that represents the type * @return */ - protected DatabaseMapping getMapping() { + public DatabaseMapping getMapping() { return this.mapping; }
>both changes look good to me, visibility change for non-spec getMapping() is good.
fixed with the final ASM upgrade issues.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink