Hello, I am using OJB 0.9.9 (from 31.01.03) I am trying to use the PersistentFieldMaxPerformanceImpl. I have modified OJB.properties and my repository.xml accordingly. It does not work (see below). I wonder how it could work. Obviously someone has it working at his site.
I have a class Link with an embedded field Matrix class Link { Matrix transformation; // embedded } class Matrix { long a1; } When I stop the debugger at line 51 in file PersistentNestedFieldMaxPerformanceImpl, method getFieldRecursive() 46 String name = fieldname.substring(0, index); 47 Field field = c.getDeclaredField(name); 48 Class nestedClass = field.getType(); // 50 String nestedName = fieldname.substring(index + 1); 51 getFieldRecursive(nestedClass, nestedName); // throws a NoSuchFieldException fieldname: java.lang.String = "transformation->a1" f: java.lang.reflect.Field = null index: int = 14 name: java.lang.String = "transformation" field: java.lang.reflect.Field = {java.lang.reflect.Field@664} nestedClass: java.lang.Class = Matrix nestedName: java.lang.String = ">a1" Question 1: nestedName= ">a1" is suspicious, isn't it? Shouldn't it be index + PATH_TOKEN.length() in line 50? (That length is 2.) How can it work for others? Question 2: Can't we include a JUnit test for that feature? I can write it. The only problem is ... Question 3: ... the PersistentFieldMaxPerformanceImpl can only be configured globally, so if we switch to it, we will not be able to test the other PersistentField-classes. Should we change this? BTW 1: The error message you get is missleading, because the exception due to the missing inner field is caught in the outermost recursive call of getFieldRecursive, so the error messages are assembled with either the complete or the outermost field name, in my case "transformation->a1" and "transformation", respectively. Since this error can be provoked by the user even after this (potential) bug is fixes, the message should be improved. BTW 2: if someone fixes this, could you please correct the package names in the javadocs, too? The "fieldaccess" is missing. The following fixes the problem for me. Sorry for the linebreaks. If someone just applies these changes to CVS, I will be happy. PersistentNestedFieldMaxPerformanceImpl.java 35c35 < * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldMaxPerformanceImpl #getFieldRecursive(Class, String) --- > * @see org.apache.ojb.broker.metadata.PersistentFieldMaxPerformanceImpl#getFieldRec ursive (Class, String) 50c50 < String nestedName = fieldname.substring(index + PATH_TOKEN.length()); --- > String nestedName = fieldname.substring(index + 1); 75c75 < * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#get(Object) --- > * @see org.apache.ojb.broker.metadata.PersistentField#get(Object) 83c83 < * @see org.apache.ojb.broker.metadata.fieldaccess.PersistentField#set(Object, Object) --- > * @see org.apache.ojb.broker.metadata.PersistentField#set(Object, Object) 132c132 < String nestedName = fieldName.substring(index + PATH_TOKEN.length()); --- > String nestedName = fieldName.substring(index + 1); 167c167 < String nestedName = fieldName.substring(index + PATH_TOKEN.length()); --- > String nestedName = fieldName.substring(index + 1); Thank you for help, Olli --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]