Hi Andrus! Thank you very much for your interest
again! I found the problem, and as you said, it was
caused by relationships, exactly by Primary Key.
I use AUTO_INCREMENT_PK in my DB, but I need to use
them on my Java code. Cayenne generate Map.map.xml
with:
<db-entity>
<.... isPrimaryKey="true" isMandatory="true">
To use PK on my code I wrote
<db-entity>
<.... isPrimaryKey="true" isMandatory="false">
and I created an entry por PK attribute:
<obj-entiy>
<and attribute that matches with PK in DB>
When I create an object I don't give a value for PK,
because it is AUTO_INCREMENT in DB. That was the
problem: when I created a new object and relation it
with other, this one didn't know the PK, because the
PK will be set in the DB, not by Cayenne.
The soluction was to write
<db-entity>
<.... isPrimaryKey="true" isMandatory="true">
and set a temporally PK in Cayenne for the object.
This PK will be rewrite in the DB.
That was all. I hope you understood everything. Thank
you very much for your track!!
Joaquin
______________________________________________
Renovamos el Correo Yahoo!: ˇ250 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es
This archive was generated by hypermail 2.0.0 : Mon Dec 06 2004 - 13:13:06 EST