Hi Andrew,

yes it's a bug.
I have made this post on the dev-list a few days ago

http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]
ache.org&msgNo=3696

regards,
Armin

----- Original Message -----
From: "Andrew Gilbert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 2:27 PM
Subject: Field Conversion not happening - Bug?


We have a simple class with a primary key that requires custom
conversion. The latest build from CVS breaks this. It looks like a
change to Identity (rev 1.13). Is this intentional? If so, how is this
supposed to work?

Assuming a simple class Foo which happens to require a custom conversion
for it's primary key, the following will fail, likely with class cast
exception. Conversion
will never have been called for the pk field.

   public class Foo {
      private GUID guid;
   }

   public class GUIDFieldConverion implements FieldConversion {
     ...
   }

  <class-descriptor
class="Foo"
table="TABLE_FOO">
<field-descriptor
name="guid"
column="GUID"
jdbc-type="VARCHAR"
primarykey="true"
      conversion="GUIDFieldConversion"/>
   </class-descriptor>

   /**
    * Test create
    */
   public void testCreate() throws Throwable {
      Foo f = new Foo();
      f.setName("TestIt");
      pb.beginTransaction();
      pb.store(f);
      pb.commitTransaction();
   }

Thanks

Index: Identity.java
===================================================================
RCS file:
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/Identity.java,v
retrieving revision 1.13
diff -r1.13 Identity.java
195,196c195
<                 // BRJ: do not convertToSql
<                 this.pkValues =
targetBroker.serviceBrokerHelper().getKeyValues(cld,
objectToIdentitify,false);
---
>                 this.pkValues =
targetBroker.serviceBrokerHelper().getKeyValues(cld,
objectToIdentitify);


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to