Just map the PK (entry_id) as an ObjAttribute (so it becomes object
property) and don't forget to set it to a non-null value before
commit. In this case Cayenne will skip the auto-generation step.
Andrus
On Apr 10, 2007, at 2:39 PM, jerome moliere wrote:
Hi all,
I'd like to trigger off the auto pk generation? I don't see how to
do that ?
Is it possible ?
I 've got a small schema with a map.xml contents like this:
<?xml version="1.0" encoding="utf-8"?>
<data-map project-version="2.0">
<property name="defaultPackage" value="data.dbcayenne"/
<property name="defaultSchema" value="dbo"/>
<db-entity name="ztextTestT" schema="dbo"
catalog="KplusLocal1">
<db-attribute name="entry_id" type="INTEGER"
isPrimaryKey="true" isMandatory=
"true" length="10"/>
<db-attribute name="ztext" type="LONGVARBINARY"
isMandatory="true" length="21
47483647"/>
</db-entity>
<obj-entity name="ZtextTestT" className="data.dbcayenne
.ZtextTestT" dbEntityName="ztextTestT">
<obj-attribute name="ztext"
type="dao.impl.cayenne.ZTextType"
db-attribute-path="ztext"/>
</obj-entity>
</data-map>
I'd like to have a PK strategy a la 'Hibernate assigned' where I
'll provide
the key..
(I can't make many things on the database managed by my customers,
so I'd
like to be as transparent as possible)
Thanks
Jerome
--
Jerome Moliere - Mentor/J
http://romjethoughts.blogspot.com/
auteur Eyrolles