You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by bobsponge <ru...@tecnicasdeingenieria.com> on 2008/07/10 15:37:23 UTC
Autogenerated keys issues
Hello,
I'm using cayenne v2.0.4 with h2 as database engine. All table indexes are
auto-generated with a auto_pk_support table. Table Indexes generation
usually works but some times I get an error like this
org.apache.cayenne.CayenneRuntimeException: [v.2.0.4 October 12 2007] Commit
Exception, org.h2.jdbc.JdbcSQLException: Unique index or primary key
violation: PRIMARY_KEY_36 ON PUBLIC.TABLETEST(ID) [23001-74]
It seems the ID generation fails with no reason at all. I usually get this
problem in the same table when several insertions are performed very
quickly. All changes in the datacontext are committed every time a new
object is created.
¿Is there any problem with h2 database and auto_pk_support?
Thank you
--
View this message in context: http://www.nabble.com/Autogenerated-keys-issues-tp18382943p18382943.html
Sent from the Cayenne - User mailing list archive at Nabble.com.
RE: Autogenerated keys issues
Posted by bobsponge <ru...@tecnicasdeingenieria.com>.
Josep, Thank you for your help but I think I can't use that solution because
"Custom Sequence" as PK generation strategy is supported in Oracle and
Postgres but maybe not in H2 database. It would be useful to set the cached
pk size value from outside the modeler but I don't know if it's possible :-(
.
Garcia Corral, Josep wrote:
>
> I had some similar problem with Oracle.
> It had to do with cached sequence numbers.
> The solution was to specify, in the modeler, Cached PK Size as 1.
>
> Hope this helps.
> Josep
>
> -----Mensaje original-----
> De: bobsponge [mailto:ruben.garcia@tecnicasdeingenieria.com]
> Enviado el: jueves, 10 de julio de 2008 15:37
> Para: user@cayenne.apache.org
> Asunto: Autogenerated keys issues
>
>
> Hello,
>
> I'm using cayenne v2.0.4 with h2 as database engine. All table indexes are
> auto-generated with a auto_pk_support table. Table Indexes generation
> usually works but some times I get an error like this
>
> org.apache.cayenne.CayenneRuntimeException: [v.2.0.4 October 12 2007]
> Commit
> Exception, org.h2.jdbc.JdbcSQLException: Unique index or primary key
> violation: PRIMARY_KEY_36 ON PUBLIC.TABLETEST(ID) [23001-74]
>
> It seems the ID generation fails with no reason at all. I usually get this
> problem in the same table when several insertions are performed very
> quickly. All changes in the datacontext are committed every time a new
> object is created.
>
> ¿Is there any problem with h2 database and auto_pk_support?
>
> Thank you
> --
> View this message in context:
> http://www.nabble.com/Autogenerated-keys-issues-tp18382943p18382943.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>
>
>
--
View this message in context: http://www.nabble.com/Autogenerated-keys-issues-tp18382943p18398644.html
Sent from the Cayenne - User mailing list archive at Nabble.com.
RE: Autogenerated keys issues
Posted by "Garcia Corral, Josep" <jo...@tecsidel.es>.
I had some similar problem with Oracle.
It had to do with cached sequence numbers.
The solution was to specify, in the modeler, Cached PK Size as 1.
Hope this helps.
Josep
-----Mensaje original-----
De: bobsponge [mailto:ruben.garcia@tecnicasdeingenieria.com]
Enviado el: jueves, 10 de julio de 2008 15:37
Para: user@cayenne.apache.org
Asunto: Autogenerated keys issues
Hello,
I'm using cayenne v2.0.4 with h2 as database engine. All table indexes are
auto-generated with a auto_pk_support table. Table Indexes generation
usually works but some times I get an error like this
org.apache.cayenne.CayenneRuntimeException: [v.2.0.4 October 12 2007] Commit
Exception, org.h2.jdbc.JdbcSQLException: Unique index or primary key
violation: PRIMARY_KEY_36 ON PUBLIC.TABLETEST(ID) [23001-74]
It seems the ID generation fails with no reason at all. I usually get this
problem in the same table when several insertions are performed very
quickly. All changes in the datacontext are committed every time a new
object is created.
¿Is there any problem with h2 database and auto_pk_support?
Thank you
--
View this message in context: http://www.nabble.com/Autogenerated-keys-issues-tp18382943p18382943.html
Sent from the Cayenne - User mailing list archive at Nabble.com.