cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Joseph <pjoseph...@yahoo.com>
Subject Re: how to persist a Collection property to postgresql using jdo
Date Mon, 11 Oct 2004 11:24:44 GMT
I am using OJB/JDO from Apache/Sun.  

I am using a postrgesql database.

I do have an enhanced class with the following method:

class MyClass
{
   Vector collToPersist;

   void setCollToPersist(Vector collToPersist) {
       this.collToPersist = collToPersist;
   }

   Vector getCollToPersist() {
       return collToPerist;
   }
}

This part works - the problem I have is how do I
persist this to a table in a database, in a single
column (not multiple rows of a child table)

thx
Paul
--- Luca Garulli <l.garulli@gmail.com> wrote:

> Hi,
> the right way to persist a collection in JDO is to
> create a class for
> the purpose with a collection member:
> 
> class MyClass
> {
>   Vector collToPersist;
> }
> 
> Then enhance the class and define the .jdo files and
> map the class to database.
> 
> What JDO implementation you are using?
> 
> 
> On Sat, 9 Oct 2004 12:01:22 -0700 (PDT), Paul Joseph
> <pjoseph_98@yahoo.com> wrote:
> > Thank you very much for the reply.  I think I
> > understand your method.
> > 
> > To simplify things however, I would like to save
> the
> > users selection as a column in the same table
> (parent)
> > and not in a separate table (child)
> > 
> > Thus the column will get data like [1,4] from the
> > multivalue widget, if the user chooses item ids
> 1,4 in
> > the multiselect.
> > 
> > The widget is using a set method in the fb:save
> that
> > sets a property that is a Java Collection.
> > 
> > My debug statments indicate it is trying to save
> > something like this [1,4] or [3,6,8] and so on.
> > 
> > so, to be more clear, I am trying to save a
> property
> > of type java.util.Collection in a column of table
> > Parent, in a postgresql db.
> > 
> > thx
> > Paul
> > 
> > 
> > --- Joose Vettenranta <joose@iki.fi> wrote:
> > 
> > > >
> > > > Basic question is - how does on persist a
> > > collection
> > > > to a postrgest table using jdo?
> > >
> > > Normally collection is just a 1:n connection to
> > > another table, like
> > >
> > > create table parent (id integer);
> > > create table child (id integer, parent integer);
> > >
> > > so you map parent to have collection Childs and
> then
> > > that Childs
> > > collection you map to be of that child table.
> > >
> > > - Joose
> > >
> > > --
> > > "Always remember that you are unique, just like
> > > everyone else!"
> > > * http://iki.fi/joose/ * joose@iki.fi * +358 44
> 561
> > > 0270 *
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail:
> > > users-help@cocoon.apache.org
> > >
> > >
> > 
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail:
> users-help@cocoon.apache.org
> > 
> > 
> 
> 
> -- 
> bye,
> Luca Garulli
> www.OrienTechnologies.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message