Hi,

Thank you very much.

I was able to get this to work - but ran into a
problem of how to persist it to the database.

So, from my debug messages, I can see that the user's
selections are available and are present correctly in
my bean as shown in the debug message below:

DEBUG : roles (of type collection) in bean are: [1206,
3]

The problem arises when I use dao to persist this
collection to the posgresql table.  What datatype
should I use for the column and repository.xml file?

I tried int4/integer for the column/repository, but it
failed without saying why.

I tried integer[]/integer and integer[]/ARRAY.  The
latter case gave the error "unknown type value".

I then tried varchar/varchar for the column/repository
whereupon, I got this error:

DEBUG : attempting setObject with bean
Error in setObject: SQL failure while insert object
data for class
org.apache.cocoon.ojb.samples.bean.DictUser, PK of the
given object is [ id=13983], object was
[EMAIL PROTECTED],
exception message is [ERROR: missing "]" in array
dimensions
]
DEBUG : finshed attempt to set Object
 
Please let me know how I should persist a collection
to a postgresql table using OJB/JDO.  

thanks!
Paul
--- Jorg Heymans <[EMAIL PROTECTED]> wrote:

> int4 (postgres) and integer.
> 
> 
> Paul Joseph wrote:
> > Yes! this helps a lot!
> > 
> > What is the field datatype in the database table
> and
> > also what is the field base data type of the
> > multi-value widget?
> > 
> > thanks
> > Paul
> > --- Jorg Heymans <[EMAIL PROTECTED]> wrote:
> > 
> > 
> >>okay, i have another case that is similar.
> >>selectedGroups is a 
> >>collections of Group objects, each group has an
> "id"
> >>and "name". Upon 
> >>loading i grab them from the db, upon saving i
> >>reconstruct a collection 
> >>with only the id's (formValue[i]) of the groups.
> >>
> >>BINDING
> >>   <fb:javascript id="targetgroups"
> >>path="selectedGroups" direction="load">
> >>     <fb:load-form>
> >>      var collection = jxpathPointer.getNode();
> >>      widget.setSelectionList(collection, "id",
> >>"name");
> >>     </fb:load-form>
> >>   </fb:javascript>
> >>
> >>   <fb:javascript id="targetgroups" path="."
> >>direction="save">
> >>     <fb:save-form>
> >>       var formValue = widget.getValue();
> >>       var collection = new java.util.ArrayList();
> >>       for(var i=0; i&lt;formValue.length; i++) {
> >>         collection.add(new
> >>java.lang.Integer(formValue[i]));
> >>       }
> >>       var bean = jxpathPointer.getNode();
> >>       bean.setSelectedGroups(collection);
> >>     </fb:save-form>
> >>   </fb:javascript>
> >>
> >>
> >>Hope this helps :-)
> >>
> >>Regards
> >>Jorg
> >>
> >>
> >>Paul Joseph wrote:
> >>
> >>>Thank you Jorg, very kind of you to reply.  This
> >>
> >>is a
> >>
> >>>good start.
> >>>
> >>>My case differs in that my multiselect list has a
> >>>"key-value" setup i.e I have things like 
> >>>
> >>>value=1 label=Worker
> >>>value=2 label=Manager
> >>>value=3 label=Admin
> >>>
> >>>and so, when I save, I want to save the values
> and
> >>
> >>not
> >>
> >>>the labels.
> >>>
> >>>ie my widget base data type is "integer"
> >>>
> >>>also, I am persisting it to a database, so the
> set
> >>>method has to finally get its value into a db.
> >>>
> >>>thx
> >>>Paul
> >>>--- Jorg Heymans <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>
> >>>>I have a multi-value widget working, here is my
> >>>>setup
> >>
> >>
> >>>>MODEL
> >>>>
> >>>><fd:multivaluefield id="style" >
> >>>> <fd:label>Style</fd:label>
> >>>> <fd:datatype base="string"/>
> >>>> <fd:selection-list>
> >>>>   <fd:item value="bold"/>
> >>>>   <fd:item value="italic"/>
> >>>> </fd:selection-list>
> >>>></fd:multivaluefield>
> >>>>
> >>>>BINDING
> >>>><fb:value id="style" path="style"/>
> >>>>
> >>>>BEAN
> >>>>private Object[] style;
> >>>>public Object[] getStyle() {
> >>>>        return style;
> >>>>}
> >>>>public void setStyle(Object[] style) {
> >>>>        this.style = style;
> >>>>}
> >>>>
> >>>>
> >>>>Does this help you ?
> >>>>
> >>>>Regards
> >>>>Jorg
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >
>
---------------------------------------------------------------------
> > 
> >>>>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]
> >>
> >>
> 
> 
>
---------------------------------------------------------------------
> 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