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

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

Hi! The "Default" generation strategy should work with meaningful PK. In case 
of PostgreSQL, Cayenne would call a DB sequence to obtain the ID. 

(BTW, please use the user mailing list for support questions. It is the main 
place for support and you get a winder community answering your questions).

> 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

Reply via email to