FAQ
Made a mistake on subject.

---------- Forwarded message ----------
From: Andres L. <andreslb151@gmail.com>
Date: 2013/10/13
Subject: Public key problem with Cayenne
To: user@cayenne.apache.org


Hi. I've reengineered my database schema using Cayenne modeler to use it
with cayenne. But, when I make this:

             Parametro a = context.newObject(Parametro.class);

             a.setRutaauditoria("Primera ruta");
             a.setNombresoftware("Software name goes here");
             a.setProduccionadicional(100f);
             a.setEstado(1);

             context.commitChanges();

I get this error:
--- ERROR --
Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
[v.3.0.2 Jun 19 2011 09:29:50] Commit Exception
     at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1149)
     at
org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1060)
     at dp1.titandevelop.titano.Main.main(Main.java:29)
Caused by: org.postgresql.util.PSQLException: ERROR: relation
"public.pk_parametro" does not exist
   Position: 16
     at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
     at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
     at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
     at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
     at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
     at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:283)
     at
org.apache.cayenne.dba.postgres.PostgresPkGenerator.longPkFromDatabase(PostgresPkGenerator.java:91)
     at
org.apache.cayenne.dba.JdbcPkGenerator.generatePk(JdbcPkGenerator.java:270)
     at
org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:172)
     at
org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:77)
     at
org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:79)
     at
org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:182)
     at
org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:134)
     at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:824)
     at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:791)
     at
org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
     at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:788)
     at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1121)
     ... 2 more
--- END OF ERROR ---

I'm using postgresql 9.2 and Cayenne 3.0.2. It's for a course project in
the university I study in.

Sorry for my bad english.


Thank you.

Search Discussions

  • Andrus Adamchik at Oct 13, 2013 at 3:30 pm
    Default PK genration mechanism in Cayenne for PostgreSQL is to use a sequence pk_[tablename]. So this is what Cayenne is attempting here. You may want to generate all required sequences in DB using the Modeler:

    http://cayenne.apache.org/docs/3.0/generate-primary-key-support.html

    Andrus

    On Oct 13, 2013, at 5:50 PM, Andres L. wrote:
    Made a mistake on subject.

    ---------- Forwarded message ----------
    From: Andres L. <andreslb151@gmail.com>
    Date: 2013/10/13
    Subject: Public key problem with Cayenne
    To: user@cayenne.apache.org


    Hi. I've reengineered my database schema using Cayenne modeler to use it
    with cayenne. But, when I make this:

    Parametro a = context.newObject(Parametro.class);

    a.setRutaauditoria("Primera ruta");
    a.setNombresoftware("Software name goes here");
    a.setProduccionadicional(100f);
    a.setEstado(1);

    context.commitChanges();

    I get this error:
    --- ERROR --
    Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
    [v.3.0.2 Jun 19 2011 09:29:50] Commit Exception
    at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1149)
    at
    org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1060)
    at dp1.titandevelop.titano.Main.main(Main.java:29)
    Caused by: org.postgresql.util.PSQLException: ERROR: relation
    "public.pk_parametro" does not exist
    Position: 16
    at
    org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
    at
    org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
    at
    org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at
    org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
    at
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
    at
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:283)
    at
    org.apache.cayenne.dba.postgres.PostgresPkGenerator.longPkFromDatabase(PostgresPkGenerator.java:91)
    at
    org.apache.cayenne.dba.JdbcPkGenerator.generatePk(JdbcPkGenerator.java:270)
    at
    org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:172)
    at
    org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:77)
    at
    org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:79)
    at
    org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:182)
    at
    org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:134)
    at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:824)
    at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:791)
    at
    org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
    at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:788)
    at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1121)
    ... 2 more
    --- END OF ERROR ---

    I'm using postgresql 9.2 and Cayenne 3.0.2. It's for a course project in
    the university I study in.

    Sorry for my bad english.


    Thank you.
  • Andres L. at Oct 14, 2013 at 6:52 am
    Hi, It finally worked with that instructions. Thank you very much.


    2013/10/13 Andrus Adamchik <andrus@objectstyle.org>
    Default PK genration mechanism in Cayenne for PostgreSQL is to use a
    sequence pk_[tablename]. So this is what Cayenne is attempting here. You
    may want to generate all required sequences in DB using the Modeler:

    http://cayenne.apache.org/docs/3.0/generate-primary-key-support.html

    Andrus

    On Oct 13, 2013, at 5:50 PM, Andres L. wrote:
    Made a mistake on subject.

    ---------- Forwarded message ----------
    From: Andres L. <andreslb151@gmail.com>
    Date: 2013/10/13
    Subject: Public key problem with Cayenne
    To: user@cayenne.apache.org


    Hi. I've reengineered my database schema using Cayenne modeler to use it
    with cayenne. But, when I make this:

    Parametro a = context.newObject(Parametro.class);

    a.setRutaauditoria("Primera ruta");
    a.setNombresoftware("Software name goes here");
    a.setProduccionadicional(100f);
    a.setEstado(1);

    context.commitChanges();

    I get this error:
    --- ERROR --
    Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
    [v.3.0.2 Jun 19 2011 09:29:50] Commit Exception
    at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1149)
    at
    org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1060)
    at dp1.titandevelop.titano.Main.main(Main.java:29)
    Caused by: org.postgresql.util.PSQLException: ERROR: relation
    "public.pk_parametro" does not exist
    Position: 16
    at
    org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
    at
    org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
    at
    org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at
    org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
    at
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
    at
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:283)
    at
    org.apache.cayenne.dba.postgres.PostgresPkGenerator.longPkFromDatabase(PostgresPkGenerator.java:91)
    at
    org.apache.cayenne.dba.JdbcPkGenerator.generatePk(JdbcPkGenerator.java:270)
    at
    org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:172)
    at
    org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:77)
    at
    org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:79)
    at
    org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:182)
    at
    org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:134)
    at
    org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:824)
    at
    org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:791)
    at
    org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
    at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:788)
    at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1121)
    ... 2 more
    --- END OF ERROR ---

    I'm using postgresql 9.2 and Cayenne 3.0.2. It's for a course project in
    the university I study in.

    Sorry for my bad english.


    Thank you.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedOct 13, '13 at 1:51p
activeOct 14, '13 at 6:52a
posts3
users2
websitecayenne.apache.org

2 users in discussion

Andres L.: 2 posts Andrus Adamchik: 1 post

People

Translate

site design / logo © 2021 Grokbase