You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "nico (JIRA)" <ji...@apache.org> on 2011/06/01 12:45:47 UTC

[jira] [Created] (CAY-1576) PK Generation with meaninful

PK Generation with meaninful 
-----------------------------

                 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




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

Re: [jira] [Created] (CAY-1576) PK Generation with meaninful

Posted by Mike Kienenberger <mk...@gmail.com>.
+1

On Wed, Jun 1, 2011 at 7:11 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
>
> On Jun 1, 2011, at 1:45 PM, nico (JIRA) wrote:
>
>> Issue Type: Question
>
> I think we should disable these arbitrary issue types. Jira is really not a support forum.
>
> Andrus

Re: [jira] [Created] (CAY-1576) PK Generation with meaninful

Posted by Aristedes Maniatis <ar...@maniatis.org>.
All done. It used to be very hard in the previous version of Jira when I tried this last, but now it was easy to restrict the tasks. All the questions became tasks.

Ari


On 2/06/11 1:38 AM, Andrus Adamchik wrote:
> +1
>
> Subtask is important. We haven't used them at Cayenne but my job I am using them a lot to organize complex requirements into development work items.
>
> Andrus
>
> On Jun 1, 2011, at 6:21 PM, Aristedes Maniatis wrote:
>
>> On 1/06/11 9:11 PM, Andrus Adamchik wrote:
>>> I think we should disable these arbitrary issue types. Jira is really not a support forum.
>>
>> I'll deal with this now and just leave:
>>
>> * task
>> * improvement
>> * bug
>> * subtask  (I have to leave this one otherwise Jira will complain)
>>
>> I'll ditch all the others and merge improvement and new feature.
>>
>> Ari
>>
>> --
>> -------------------------->
>> Aristedes Maniatis
>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>
>

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Re: [jira] [Created] (CAY-1576) PK Generation with meaninful

Posted by Andrus Adamchik <an...@objectstyle.org>.
+1 

Subtask is important. We haven't used them at Cayenne but my job I am using them a lot to organize complex requirements into development work items.

Andrus

On Jun 1, 2011, at 6:21 PM, Aristedes Maniatis wrote:

> On 1/06/11 9:11 PM, Andrus Adamchik wrote:
>> I think we should disable these arbitrary issue types. Jira is really not a support forum.
> 
> I'll deal with this now and just leave:
> 
> * task
> * improvement
> * bug
> * subtask  (I have to leave this one otherwise Jira will complain)
> 
> I'll ditch all the others and merge improvement and new feature.
> 
> Ari
> 
> -- 
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
> 


Re: [jira] [Created] (CAY-1576) PK Generation with meaninful

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 1/06/11 9:11 PM, Andrus Adamchik wrote:
> I think we should disable these arbitrary issue types. Jira is really not a support forum.

I'll deal with this now and just leave:

* task
* improvement
* bug
* subtask  (I have to leave this one otherwise Jira will complain)

I'll ditch all the others and merge improvement and new feature.

Ari

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Re: [jira] [Created] (CAY-1576) PK Generation with meaninful

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jun 1, 2011, at 1:45 PM, nico (JIRA) wrote:

> Issue Type: Question

I think we should disable these arbitrary issue types. Jira is really not a support forum.

Andrus

[jira] [Issue Comment Edited] (CAY-1576) PK Generation with "meaningful PK"

Posted by "nico (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042209#comment-13042209 ] 

nico edited comment on CAY-1576 at 6/1/11 2:53 PM:
---------------------------------------------------

I found something.
I think it can be done with 
DataContext context = DataContext.createDataContext();
((PostgresAdapter)context.getParentDataDomain().getNode("someNodeYouCreatedWithModeler").getAdapter()).setSupportsGeneratedKeys(true);

because it is not supported by default.
But I think it would be nice, if I can configure it in Cayenne Modeler.

      was (Author: hype11):
    I found something.
I think it can be done with 
DataContext context = DataContext.createDataContext();
((PostgresAdapter)context.getParentDataDomain().getNode("PostgreNode").getAdapter()).setSupportsGeneratedKeys(true);

because it is not supported by default.
But I think it would be nice, if I can configure it in Cayenne Modeler.
  
> 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

[jira] [Updated] (CAY-1576) PK Generation with "meaningful PK"

Posted by "nico (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nico updated CAY-1576:
----------------------

         Labels: features  (was: )
    Description: 
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?

thanks in advance
        Summary: PK Generation with "meaningful PK"  (was: PK Generation with meaninful )

> 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?
> thanks in advance

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

[jira] [Updated] (CAY-1576) PK Generation with "meaningful PK"

Posted by "nico (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nico updated CAY-1576:
----------------------

    Description: 
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

  was:
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?

thanks in advance


> 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

[jira] [Closed] (CAY-1576) PK Generation with "meaningful PK"

Posted by "nico (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nico closed CAY-1576.
---------------------

    Resolution: Not A Problem

see comments

> 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

[jira] [Commented] (CAY-1576) PK Generation with "meaningful PK"

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Commented] (CAY-1576) PK Generation with "meaningful PK"

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Commented] (CAY-1576) PK Generation with "meaningful PK"

Posted by "nico (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045417#comment-13045417 ] 

nico commented on CAY-1576:
---------------------------

Hi Andrus,
I see the SQL activity in the logs (output) and it get the first Id with "SELECT nextval('XXXXX')". That is what I tried to describe.
The generation of 20 Ids by Cayenne after the select on sequence in database is the default generation strategy by Cayenne.
But then I select "Database-generated" in the modeler, I intended that Cayenne let the database generate the keys.

You have to set also support generated keys on adapter with:
((PostgresAdapter)context.getParentDataDomain().getNode("someNodeYouCreatedWithModeler").getAdapter()).setSupportsGeneratedKeys(true);

to let the database generate all Ids.

But you cannot cast to PostgresAdapter without set in the Cayenne Modeler in the created node under the tab "adapter" the "custom adapter" to "org.apache.cayenne.dba.postgres.PostgresAdapter"

If you do that all, the generation of primary keys are made in the database with PostgreSql 9.

I hope that helps other users with the same problem.

regards

> PK Generation with "meaningful PK"
> ----------------------------------
>
>                 Key: CAY-1576
>                 URL: https://issues.apache.org/jira/browse/CAY-1576
>             Project: Cayenne
>          Issue Type: Task
>          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

[jira] [Updated] (CAY-1576) PK Generation with "meaningful PK"

Posted by "nico (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nico updated CAY-1576:
----------------------


I found something.
I think it can be done with 
DataContext context = DataContext.createDataContext();
((PostgresAdapter)context.getParentDataDomain().getNode("PostgreNode").getAdapter()).setSupportsGeneratedKeys(true);

because it is not supported by default.
But I think it would be nice, if I can configure it in Cayenne Modeler.

> 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