Thought I would post this answer here, I posted it on stackoverflow as well.
I found the problem and it is part of the method checkForOrphanProperties in JPAOverridenAnnotationReader:
Code:
for (Method method : clazz.getMethods()) {
String name = method.getName();
if ( name.startsWith( "get" ) ) {
properties.add( Introspector.decapitalize( name.substring( "get".length() ) ) );
}
else if ( name.startsWith( "is" ) ) {
properties.add( Introspector.decapitalize( name.substring( "is".length() ) ) );
}
}
The problem is that the method looks for all public fields and then starts adding field names based on "get" and "is" methods it finds. The Introspector.decapitalize method utilizes specific rules to determine what to decapitalize.
From the Introspector class:
Code:
/**
* Utility method to take a string and convert it to normal Java variable
* name capitalization. This normally means converting the first
* character from upper case to lower case, but in the (unusual) special
* case when there is more than one character and both the first and
* second characters are upper case, we leave it alone.
* <p>
* Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays
* as "URL".
*
* @param name The string to be decapitalized.
* @return The decapitalized version of the string.
*/
public static String decapitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
Character.isUpperCase(name.charAt(0))){
return name;
}
char chars[] = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
So for instance our field is:
Code:
private String eAddress;
And our getter is:
Code:
public String getEAddress() {
return eAddress;
}
So based on the Introspector.decapitalize functionality, the result of the decapitalize would be "EAddress", not "eAddress". Because it sees two capital letters in the "EAddress" when the code substrings off the "get"...it won't decapitalize those. Therefore it complains that the eAddress field in the orm.xml doesn't exist. The persistence of the field works totally fine, these warnings just show up when the war starts and the files are bootstrapped.