OK, I've got some progress.
I've created my own transformer based on AliasToBeanResultTransformer in which I use reflection to discover the correct case of the property.
This seems to take care of the naming issue but I'm not there yet as the types don't match in the return list.
I don't know how to get around that obstacle yet...
Relevant portion of SQLAliasToBeanResultTransformer:
Code:
private Fields[] fields = resultClass.getDeclaredFields();
public Object transformTuple(Object[] tuple, String[] aliases) {
Object result;
try {
if ( setters == null ) {
setters = new Setter[aliases.length];
for ( int i = 0; i < aliases.length; i++ ) {
String alias = aliases[i];
if ( alias != null ) {
Setter setter;
try {
setter = propertyAccessor.getSetter(resultClass, alias);
} catch (PropertyNotFoundException e) {
for (Field field : this.fields) {
String fieldName = field.getName();
if (fieldName.equalsIgnoreCase(alias)) {
alias = fieldName;
break;
}
}
setter = propertyAccessor.getSetter(resultClass, alias);
}
setters[i] = setter;
}
}
}
result = resultClass.newInstance();
for ( int i = 0; i < aliases.length; i++ ) {
if ( setters[i] != null ) {
setters[i].set( result, tuple[i], null );
}
}
}
catch ( InstantiationException e ) {
throw new HibernateException( "Could not instantiate resultclass: " + resultClass.getName() );
}
catch ( IllegalAccessException e ) {
throw new HibernateException( "Could not instantiate resultclass: " + resultClass.getName() );
}
return result;
}