cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sagar bijlwan <sagar.bijl...@gmail.com>
Subject Re: Issue while accessing primary key in cayenne 4.0.M4
Date Fri, 20 Jan 2017 16:48:02 GMT
Thanks Andrus for the prompt reply,

I think how I was able to generate setter for the PK in Cayenne 3.

1. While reengineering DB schema in modeler, there is a checkbox for
meaningful PK.
2. I checked that one and hence it resulted in setter for PK.

However, in revamped UI of 4.0.M4, this checkbox is chucked out and now
there is a text field which is pretty subtle change and I happen to miss
that. Once I write name of the table in the field, generated model has the
PK as a property.

Now this was fine with single table. If there are multiple tables then Is
a comma separated list of table names a good approach ? or what you
mentioned in point 2 of your previous mail ? ( my bet is on this ).

Regards
Sagar

On Fri, Jan 20, 2017 at 4:17 PM, Andrus Adamchik <andrus@objectstyle.org>
wrote:

> Actually NOT making PK a part of the object model was a default in Cayenne
> since day 1.
>
> 1. If all you need is to read the PK value, you can use
> Cayenne.pkForObject(..)
> 2. If this is a meaningful PK and you need a setter, just create a new
> ObjAttribute in the Modeler manually and map it to PK column.
>
> HTH,
> Andrus
>
> ---------------
> Andrus Adamchik
> @andrus_a | @ApacheCayenne
>
> > On Jan 20, 2017, at 10:50 AM, sagar bijlwan <sagar.bijlwan@gmail.com>
> wrote:
> >
> > Hello,
> >
> > In cayenne 3 primary key column is also available as a property in auto
> > generated java model so it can  be easily accessed using setters and
> > getters, However, it seems same can't be said about cayenne 4. When I am
> > generating Java model of the same DB table, I am only getting PK column (
> > and not the new "Property" type for the primary key) thus I don't have
> any
> > setters and getters for the primary key.
> >
> > Am I missing something here as I don't seem to recall doing anything
> > special in cayenne 3? Or should I do anything extra in cayenne 4 to make
> it
> > work?
> >
> > Any insight into this would be appreciated.
> >
> > Regards
> > Sagar
>
>
>


-- 
S A M

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message