cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Razumovsky" <razumovsky.and...@gmail.com>
Subject Re: Problem with sequences in PostgreSQL
Date Fri, 05 Dec 2008 07:36:48 GMT
Cayenne's default strategy uses extra table, "auto_pk_support". Obviously
other apps working with your DB do not use this table. You should change PK
Generation strategy to 'Database Sequence' or something

2008/12/5, Germán Mondragón <german@welinux.cl>:
>
> Hi,
>
> Hello, i have an application that must live with other applications
> inserting rows in a table.
>
> The problem is that cayenne postgresql adapter don't increment the sequence
> according to the number of rows inserted, this provokes an inconsistency
> with the ids in the table and the last value in the sequence. As a
> consequence when the other external program try to insert rows, the call to
> nextval generates a duplicate primary key, and the application crashes.
>
> I've configured web.xml parameters the next way:
>   <init-param>
>         <param-name>shared-cache</param-name>
>         <param-value>false</param-value>
> </init-param>
>
> And cayenne maps this way:
> <db-entity name="test_a" schema="public">
>                  <db-attribute name="descripcion" type="VARCHAR"
> length="100"/>
>                  <db-attribute name="id_test" type="INTEGER"
> isPrimaryKey="true" isMandatory="true"/>
> </db-entity>
>
> <obj-entity name="TestA" className="TestA" dbEntityName="test_a">
>                  <obj-attribute name="descripcion" type="java.lang.String"
> db-attribute-path="descripcion"/>
> </obj-entity>
>
>
> Pk Generation strategy = Default.
>
>
> user@cayenne.apache.org
>
>
> Thanks for reading
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message