You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Robert Crawford <cr...@kloognome.com> on 2004/08/26 02:35:36 UTC

Storing binary streams/arrays?

I have a table mapped as follows:


<class-descriptor class="com.gearlist.gear.ojb.GearPhotoDataInstance"
table="gl_gear_photo_data">
    <field-descriptor name="gearPhotoNbr" column="gear_photo_nbr"
jdbc-type="INTEGER"/>
    <field-descriptor name="photoData" column="photo_data"
jdbc-type="BINARY"/>
</class-descriptor>

The column on the database is a binary field (MySQL blob). The photoData
field in the GearPhotoDataInstance class is a byte[].

Whenever I try to store an object, I get this exception:

 org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: [B
not found in OJB Repository

I'm pretty sure "[B" is the "class" for a byte array, but I thought the
BINARY jdbc-type stored and read byte arrays. I've checked the
documentation and the mailing lists, but can't find what I'm doing wrong.

Also, I'd LOVE to do this with a Blob object, to improve memory usage, but
can't figure out how to use it. The documentation for that's not complete.
Any tips?


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org