Been doing a lot of development lately implementing our document repository.
Specifics include OJB 1.0.4 and MySql 5.0 with a fairly recent driver.
We were using LONGVARCHAR to represent long textual information, but was
hoping to make it a bit more generic by changing over to using a BLOB.
Our mapping is:
<class-descriptor class="com.comp.prod.model.document.DocumentContentVO"
table="doc_content">
<object-cache
class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
<attribute attribute-name="timeout" attribute-value="3600" />
</object-cache>
<field-descriptor name="docId" column="doc_id"
jdbc-type="BIGINT" primarykey="true" />
<field-descriptor name="content" column="content"
jdbc-type="BLOB" />
</class-descriptor>
Basically our DocumentContentVO contains just the two attributes:
public Long docId;
public java.sql.Blob content;
With the appropriate getters and setters. The MySql database has a nullable
content column of type blob.
We were going to use javax.sql.rowset.serial.SerialBlob to add Blobs back
into the database, but it never gets this far. It throws an exception when
it attempts to use our mapping to this object above in an initial query.
We get the following error:
Exception: IllegalAccess error setting field:content in
object:com.comp.prod.model.document.DocumentContentVO host=0:0:0:0:0:0:0:1:
org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
setting field:content in
object:com.comp.prod.model.document.DocumentContentVO
at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl.setValueFor(Unknown
Source)
at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl.set(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildOrRefreshObject(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectFrom(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown
Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
Caused by: java.lang.IllegalArgumentException: Can not set java.sql.Blob
field com.comp.prod.model.document.DocumentContentVO.content to [B
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:657)
... 79 more
Any ideas?
Thanks as usual.
John
-----
JohnE
http://www.jobbank.com jobbank.com
--
View this message in context:
http://www.nabble.com/Blobs-tp19505549p19505549.html
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at
Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]