Re: Hairy problem with has_a and has_many

[prev] [thread] [next] [Date index for 2005/02/22]

From: Cees Hek
Subject: Re: Hairy problem with has_a and has_many
Date: 16:22 on 22 Feb 2005
On Tue, 22 Feb 2005 17:00:10 +0100, JJ Merelo <jjmerelo@xxxxx.xxx> wrote:
> ---->8--------------
> create table rol(
>         rol_tipo        varchar(20) references rol_tipo (descripcion),
>         persona_id      integer references persona on delete cascade,
>         simposio_codigo varchar(5) references simposio on delete cascade,
>         unique( persona_id, simposio_codigo, rol_tipo )
> );
> ---------------------
> Here's the module:
> ---->8--------------
> package My::CEDI::Rol;
> 
> __PACKAGE__->table('rol');
> __PACKAGE__->columns( Essential => qw( rol_tipo persona_id simposio_codigo) );

You need to specify the primary key for the table.  If you do not
specify the primary key, CDBI assumes it is the first entry of the
columns provided.  So in this case CDBI assumes that rol_tipo is the
primary key, but it looks like from the table definition it should be
a multi column primary key (rol_tipo persona_id simposio_codigo) so
you should specify it directly.

Also, CDBI does not work well with primary keys that are inflated
using has_a.  You are probably better off creating a single column
primary key (using a sequence) for this table and allow CDBI to use
that instead.  Then you can keep the has_a relationships as they are.

I am not sure if that will solve the problem you are facing, but it
should give you a place to continue.

Cheers,

        -- 
        Cees Hek

(message missing)

Hairy problem with has_a and has_many
JJ Merelo 16:00 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
Cees Hek 16:22 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
Joss Shaw 16:24 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
JJ Merelo 16:50 on 22 Feb 2005

And now with ContextualFetch
JJ Merelo 16:55 on 22 Feb 2005

Re: And now with ContextualFetch
Perrin Harkins 18:15 on 22 Feb 2005

Re: And now with ContextualFetch
JJ Merelo 18:25 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
Perrin Harkins 18:17 on 22 Feb 2005

Re: And now with ContextualFetch
Perrin Harkins 18:41 on 22 Feb 2005

Re: And now with ContextualFetch
JJ Merelo 18:56 on 22 Feb 2005

RE: Hairy problem with has_a and has_many
Zhuang Li 20:03 on 23 Feb 2005

RE: Hairy problem with has_a and has_many
Zhuang Li 20:12 on 23 Feb 2005

Generated at 22:43 on 24 Feb 2005 by mariachi v0.52