[ 
https://issues.apache.org/jira/browse/CAY-2478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nikita Timofeev updated CAY-2478:
---------------------------------
    Description: 
To use PK in query (in where or order by clause) you need to write custom 
expressions and that is most likely ugly (something like 
{{ExpressionFactory.matchDbExp("db:" + Artist.ARTIST_ID_PK_COLUMN, 1)}})

So we may just use Cayenne Property API and generate these properties in cgen 
tools. This will lead to much cleaner code: {{Artist.ARTIST_ID_COLUMN.eq(1)}}

A few things to keep in mind:
 * PK can be compound, in that case there should be several properties
 * PK can be already mapped on ObjAttribute, in that case we shouldn't generate 
anything
 * PK property naming shouldn't clash with other properties
 * this feature should be optional (or not?)

  was:
To use PK in query (in where or order by clause) you need to write custom 
expressions and that is most likely ugly (something like 
{{ExpressionFactory.matchDbExp("db:" + Artist.ARTIST_ID_PK_COLUMN, 1)}})

So we may just use Cayenne Property API and generate these properties in cgen 
tools.

A few things to keep in mind:
 * PK can be compound, in that case there should be several properties
 * PK can be already mapped on ObjAttribute, in that case we shouldn't generate 
anything
 * PK property naming shouldn't clash with other properties
 * this feature should be optional (or not?)


> cgen: Generate properties for PK
> --------------------------------
>
>                 Key: CAY-2478
>                 URL: https://issues.apache.org/jira/browse/CAY-2478
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Modeler, Non-GUI Tools
>            Reporter: Nikita Timofeev
>            Priority: Major
>             Fix For: 4.1.M3
>
>
> To use PK in query (in where or order by clause) you need to write custom 
> expressions and that is most likely ugly (something like 
> {{ExpressionFactory.matchDbExp("db:" + Artist.ARTIST_ID_PK_COLUMN, 1)}})
> So we may just use Cayenne Property API and generate these properties in cgen 
> tools. This will lead to much cleaner code: {{Artist.ARTIST_ID_COLUMN.eq(1)}}
> A few things to keep in mind:
>  * PK can be compound, in that case there should be several properties
>  * PK can be already mapped on ObjAttribute, in that case we shouldn't 
> generate anything
>  * PK property naming shouldn't clash with other properties
>  * this feature should be optional (or not?)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to