Hi Stefan,

You misinterpreted the documentation.
Of course OJB can handle Vector attributes explicitely. 
But this does only work for full relationships between mapped entity classes
that are are backed by a full 1:n relationship between two database tables.

What you are try to do is a completely different thing!
You don't want to map a 1:n releatioship between entities. Because
java.lang.String is not an entity class!
So OJB is right in complaining about the type mismatch!

But you are lucky, you can do this kind of mapping with OJB!
You just have to define a FieldConversion that allows to store a Vector in a
VARCHAR field.
The FieldConversion you are looking for is: 
org.apache.ojb.broker.accesslayer.conversions.Object2ByteArrFieldConversion

cheers,
Thomas Mahler

> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 17. Dezember 2002 11:28
> An: [EMAIL PROTECTED]
> Betreff: Mapping Vector into single column ?
> 
> 
> Hi,
> 
> I would like to map a Vector of strings  into a single VACHAR column.
> According to the documentation OJB handles Vectors itself.
>  I added a field descriptor:
> 
> <field-descriptor id="6" name="stringEntries" column="stringEntries"
> jdbc-type="VARCHAR"/>
> 
> The getter/setter return a List or Vector (tried both)
> 
> Storing is fine, the vector contains strings and these are 
> stored as e.g.
> [Deutsch, Englisch]
> 
> Lookup however fails with IllegalArgumentException i.e.
> 
> [org.apache.ojb.broker.util.sequence.SequenceManagerFactory] INFO: Use
> sequence manager class: class
> org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl
> [org.apache.ojb.broker.accesslayer.AbstractPoolableConnectionF
> actory] INFO:
> # Create connection pool for JdbcDescriptorKey -1967118950 #
> [DEFAULT] ERROR: Error in operation [set] of object
> [PersistentFieldPropertyImpl], java.lang.IllegalArgumentException
> [DEFAULT] ERROR: Declaring class
> [de.intermediate.components.list.ListDefinitionValue]
> [DEFAULT] ERROR: Property Name [stringEntries]
> [DEFAULT] ERROR: Property Type [java.util.Vector]
> [DEFAULT] ERROR: anObject was class
> [de.intermediate.components.list.ListDefinitionValue]
> [DEFAULT] ERROR: aValue was class [java.lang.String]
> java.lang.IllegalArgumentException: argument type mismatch
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.apache.ojb.broker.metadata.PersistentFieldPropertyImpl.set(Unknown
> Source)
> 
> 
> Any ideas where I should look further?  May this not be 
> possible, or may
> this require a special FieldConversion?
> 
> Thanks for any suggestions,
> 
> Stefan Schl�sser
> 
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



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

Reply via email to