I have a field conversion on an auto incrementing primary key field in
version 0.9.8 of OJB.
 
When creating a new object (without initializing the PK, as I want it 
autoincrementing) I get this partial stack trace:
 
13:15:33,523 ERROR [DEFAULT] org.apache.ojb.broker.OJBRuntimeException:
Error while trying to autoincrement field class com.f
orgent.gss.resourcescheduler.persistence.RoomReservation#reservationKey:
Error invoking method:setReservationKey in object:co
m.forgent.gss.resourcescheduler.persistence.RoomReservation: argument type
mismatch
13:15:33,553 ERROR [STDERR] java.lang.IllegalArgumentException: argument
type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(P
ersistentFieldPropertyImpl.java:113)
        at
org.apache.ojb.broker.metadata.ClassDescriptor.getAutoIncrementValue(ClassDe
scriptor.java:1127)
...... 
 
 
I notice that in org.apache.ojb.broker.ClassDescriptor.java
around line 1127 looks  like this:
 
if (result != null)
{
     result = broker.getUniqueObject(fmd);                            
     // reflect  autoincrement value back into object
     f.set(obj, result);
}
 
I think there should be something like:  
 
result=fieldConversion.sqlToJava(result)
 
after the getUniqueObject() call. 
 
Is this correct?
 
Thanks.

Reply via email to