cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-1576) PK Generation with "meaningful PK"
Date Wed, 01 Jun 2011 15:04:47 GMT

    [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042215#comment-13042215
] 

Andrus Adamchik commented on CAY-1576:
--------------------------------------

"Database-generated" is a strategy based on "autoincrement column" DB feature which IIRC didn't
work with PG 8. Not sure about 9. We may want to test it, but are you sure you are not seeing
SQL in the logs like "SELECT nextval('XXXXX')" (which would mean that the "Defаult" strategy
is in effect, regardless of the modeler settings).

> PK Generation with "meaningful PK"
> ----------------------------------
>
>                 Key: CAY-1576
>                 URL: https://issues.apache.org/jira/browse/CAY-1576
>             Project: Cayenne
>          Issue Type: Question
>          Components: Database integration
>    Affects Versions: 3.1M1
>         Environment: Win7 with PostgreSQL 9
>            Reporter: nico
>              Labels: features
>
> I have a question about the primary generation.
> I generate all classes with the Cayenne Modeler from the database with "meaningful PK"
option, because I need the getId()-method from the entity, which gives me the Pk from the
database.
> I set the Pk Generation Stategy to Database-Generated in all DbEntities, because I don't
wan't to set the Pk by myself or by Cayenne, but by database.
> Now I have the situation that Cayenne fetch the first PK from DB by calling the sequence
in Db, then Cayenne increment the ID 20 times (on 20 inserts) and send the IDs (PKs) to database,
then cayenne call another time the sequence for next Pk id and so on.
> But I don't want that cayenne send any generated PK Id to database and only let the database
generate the Ids. I think this is a result of the "meaningful PK" setting.
> Is there any solution to get the database PK Id from a Object Entity (at best with getId()-method)
without a database call and let the database generate the primary keys?
> I hope this is understandable.
> thanks in advance

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message