You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Garth Keesler <ga...@gdcjk.com> on 2012/10/30 23:52:27 UTC

Modeler Reverse Engineered Entities Don't Match

Very new at Cayenne. Trying to extract the DBEntities and OBJEntities 
from a PG database as shown in the tutorial. All tables in the selected 
schema are extracted but the resultant DB and OBJ entities don't match 
each other WRT the number of attributes. I'm still looking for a pattern 
but it seems that the DBEntities match the schema while the OBJEntities 
are typically missing at least one attribute; sometimes several. I'm 
still RTFMing but any helpful pointers would be appreciated.

Thanx,
Garth

Re: Modeler Reverse Engineered Entities Don't Match

Posted by Garth Keesler <ga...@gdcjk.com>.
That explains it. This is my first experience with an ORM so I've a lot 
to learn but it appears that FK objects related to a particular object I 
select will also be available automagically much as in J2EE which I've 
played with a bit as well.  Neat. No need to respond since I'll dig this 
out of the manual and thru more tests.

Much to learn (and that's the fun part of it:-).

Thanx Much,
Garth

On 11/01/2012 01:37 AM, Andrus Adamchik wrote:
> PK and FK columns are intentionally not mapped as ObjAttributes. An FK is redundant (you already have a mapped relationship for that), and PK is presumed to be of no consequence in the object model, so it is hidden inside ObjectId of each persistent object. For meaningful PKs, you can create ObjAttributes yourself. And if you need to read a value of a hidden PK, use org.apache.cayenne.Cayenne utility class.
>
> Andrus
>
> On Oct 31, 2012, at 1:52 AM, Garth Keesler <ga...@gdcjk.com> wrote:
>
>> Very new at Cayenne. Trying to extract the DBEntities and OBJEntities from a PG database as shown in the tutorial. All tables in the selected schema are extracted but the resultant DB and OBJ entities don't match each other WRT the number of attributes. I'm still looking for a pattern but it seems that the DBEntities match the schema while the OBJEntities are typically missing at least one attribute; sometimes several. I'm still RTFMing but any helpful pointers would be appreciated.
>>
>> Thanx,
>> Garth
>>
>
>


Re: Modeler Reverse Engineered Entities Don't Match

Posted by Andrus Adamchik <an...@objectstyle.org>.
PK and FK columns are intentionally not mapped as ObjAttributes. An FK is redundant (you already have a mapped relationship for that), and PK is presumed to be of no consequence in the object model, so it is hidden inside ObjectId of each persistent object. For meaningful PKs, you can create ObjAttributes yourself. And if you need to read a value of a hidden PK, use org.apache.cayenne.Cayenne utility class.

Andrus

On Oct 31, 2012, at 1:52 AM, Garth Keesler <ga...@gdcjk.com> wrote:

> Very new at Cayenne. Trying to extract the DBEntities and OBJEntities from a PG database as shown in the tutorial. All tables in the selected schema are extracted but the resultant DB and OBJ entities don't match each other WRT the number of attributes. I'm still looking for a pattern but it seems that the DBEntities match the schema while the OBJEntities are typically missing at least one attribute; sometimes several. I'm still RTFMing but any helpful pointers would be appreciated.
> 
> Thanx,
> Garth
>