[Catalyst] DBIx::Class method, "update_or_create_related" - it tries to populate the primary key value of the related object

Felix Antonius Wilhelm Ostmann ostmann at websuche.de
Mon Aug 18 14:14:38 BST 2008


perhaps i have the same problem. I already send a patch to the IRC with 
a test-case.

Can you write a short test too?


kakimoto at tpg.com.au schrieb:
> hello, all,
>
>  I am trying to use DBIx::Class method, "update_or_create_related" to
> cut down the amount of code I have. My code has happily worked with
>
> 1) me manually doing a search (with "find") to see if an object in
> question exists or not. If it doesn't, I will issue a "new"/"create" .
> Else, the "find" will give out the object, I perform whatever I need to
> perform on the attributes and update it.
>
> 2) the database table of the related object has a nice sequence set up
> for its primary key, "ID".
>
> Now, when I tried to use "update_or_create_related", the code actually
> produces an error for which the "ID" attribute in the SQL for INSERT is
> null and hence, cannot be inserted to the database engine for reason
> that a primary key attribute value can never be NULL.
>
>  It's fair up there but I just do not know why is DBIX::Class even
> bothering to put the primary key value, ID into the dynamic SQL that it
> uses to insert the entry into the database when there's already a
> sequence declared for it....
>
>
>
>
>
> Help!!
>
>
> K. akimoto
>  - it tries to populate the primary key value of the related object
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
>   


-- 
Mit freundlichen Grüßen

Felix Antonius Wilhelm Ostmann
--------------------------------------------------
Websuche   Search   Technology   GmbH   &   Co. KG
Martinistraße 3  -  D-49080  Osnabrück  -  Germany
Tel.:   +49 541 40666-0 - Fax:    +49 541 40666-22
Email: info at websuche.de - Website: www.websuche.de
--------------------------------------------------
AG Osnabrück - HRA 200252 - Ust-Ident: DE814737310
Komplementärin:     Websuche   Search   Technology
Verwaltungs GmbH   -  AG Osnabrück  -   HRB 200359
Geschäftsführer:  Diplom Kaufmann Martin Steinkamp
--------------------------------------------------




More information about the Catalyst mailing list