When using annotated beans I found an instance where if you have a field name which then has a method name where that method name has 2 uppercase characters in a row, the Introspector.decapitalize() method will leave that property alone. This then causes HQL to fail when you try to reference the actual field name (as we try to keep with the bean property format). Example:
class Foo {
private String bAr = "";
@Column(name = "bar")
public String getBAr() { return this.bAr; }
public void setBAr(String bAr) { this.bAr = bAr; }
}
When referencing "Foo.bAr = " in HQL it will fail saying that "bAr" doesn't exist. In the logs, the field is actually referenced (by the AnnotationBinder) as "Foo.BAr"
I'm not sure if this is intended, and I understand why (given the concept behind the Introspector.decapitalize() functionality) it works this way. But if this is correct, then maybe there should be some documentation to at least indicate that this is how it works since it is not as simple as "capitalize/decapitalize the first letter."
|