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 George Mardale <gi...@delsyne.ro> on 2004/12/02 10:09:29 UTC

Object2ByteArrFieldConversion

Hi everybody,

is it possible to use 
org.apache.ojb.broker.accesslayer.conversions.Object2ByteArrFieldConversion 
to store an instance of an user-defined-class as a byte array in a table 
column (the user defined class contains only strings and int attributes)?

The idea is that I have a JDO class that contains another class 
(non-JDO). I tried to persist an instance of the second class as a byte 
array in a column in the table corresponding to the outer class, but it 
does not work. I can persist correctly the inner object and the outer 
object, but when I fetch the outer object, the inner object is always null.

I executed the code step-by-step (recompiled OJB and JDORI with debug=on 
for that) and I noticed that the fetch is performed correctly until some 
point. I mean, OJB correctly fetches my inner object together with my 
outer object, but at some point the inner value is lost (i.e., inside 
OJB-JDO workflow, based on the collection returned by 
getCollectionByQuery, a new collection of objects is created. This 
collection is returned by OJB-JDO as a result of my query. The problem 
is that the attributes in the every object from the new collection are 
set by using the jdo-settings from the corresponding enhanced class. And 
since my inner object is an instance of a non-JDO class, the inner 
object is ignored).

I also tried to enhace my inner class, but I also get an error. When I 
try to persist an outer  object, I get an exception in Identity class. 
Do you have any idea how I can set the class descriptor of the inner 
class, to avoid this problem?

Thanks in advance,
George.

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