Hello, Just tried my first application with Hibernate and SAPDB (using middlegen plugin release 3) and encountered one bug (or maybe feature): suppose you have table with column "N_VALUE" (SAPDB keeps everything in uppercase). So property name becomes "nValue", getter becomes "getNValue()". Reflection code in class net.sf.hibernate.util.ReflectHelper.getterMethod() does following:
---------------------------------------------------------------------------- ---------------------------------------------- private static Method getterMethod(Class theClass, String propertyName) { Method[] methods = theClass.getDeclaredMethods(); for (int i=0; i<methods.length; i++) { // only carry on if the method has no parameters if(methods[i].getParameterTypes().length==0) { // try "get" if( (methods[i].getName().length() > 3) && methods[i].getName().startsWith("get") ) { String testStdMethod = Introspector.decapitalize( methods[i].getName().substring(3) ); String testOldMethod = methods[i].getName().substring(3); if( testStdMethod.equals(propertyName) || testOldMethod.equals(propertyName) ) return methods[i]; } // if not "get" then try "is" if( (methods[i].getName().length() > 2) && methods[i].getName().startsWith("is") ) { String testStdMethod = Introspector.decapitalize( methods[i].getName().substring(2) ); String testOldMethod = methods[i].getName().substring(2); if( testStdMethod.equals(propertyName) || testOldMethod.equals(propertyName) ) return methods[i]; } } } return null; } ---------------------------------------------------------------------------- ---------------------------------------------- and Introspector.decapitalize("getNValue".substring(3)) returns "NValue" (!?!) and of course "nValue".equals("NValue") is false. So we get exception during execution. My fix was following: ... if( (methods[i].getName().length() > 3) && methods[i].getName().startsWith("get") ) { String testStdMethod = Introspector.decapitalize( methods[i].getName().substring(3) ); String testOldMethod = methods[i].getName().substring(3); String methodName = "get" + Character.toUpperCase(propertyName.charAt(0)) + (propertyName.length() > 1 ? propertyName.substring(1) : ""); if( testStdMethod.equals(propertyName) || testOldMethod.equals(propertyName) || methodName.equals(methods[i].getName())) return methods[i]; } ... and the same in setterMethod(). Is this fixed allready in hibernate 2.1 ? Greetings, Donatas ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel