Hi list,
I've followed problem and I hope anyone can help:
I've 2 tables. One of them is a 'constants' table:
table: person_states
+-------------+------------------+-------------+
| PersonState | ShortDescription | Description |
+-------------+------------------+-------------+
| 1 | VALID | valid |
| 2 | DELETED | deleted |
+-------------+------------------+-------------+
with mapping:
-----8<----------8<----------8<-----
<class
name="de.vidsoft.bos.struts.service.impl.BOSPersonStateCastorJDO"
identity="id" key-generator="IDENTITY" access="shared" >
<description>BOS person states for internal use</description>
<cache-type type="count-limited" capacity="2"/>
<map-to table="person_states" />
<field name="id" type="integer" >
<sql name="PersonState" type="integer" />
</field>
<field name="ShortDescription" type="string" >
<sql name="ShortDescription" type="varchar" />
</field>
<field name="Description" type="string" >
<sql name="Description" type="varchar" />
</field>
</class>
-----8<----------8<----------8<-----
and a table: persons
+-------------+-------------+-----------+----------+
| BosPersonID | PersonState | FirstName | LastName |
+-------------+-------------+-----------+----------+
| 1 | 1 | Test1 | Test1 |
| 2 | 2 | test2 | Test2 |
+-------------+-------------+-----------+----------+
with mapping:
-----8<----------8<----------8<-----
<class name="de.vidsoft.bos.struts.service.impl.BOSPersonCastorJDO"
identity="BosPersonID" key-generator="IDENTITY">
<description>Person records</description>
<cache-type type="unlimited" />
<map-to table="persons" />
<field name="BosPersonID" type="integer" >
<sql name="BosPersonID" type="integer" />
</field>
<field name="BosPersonState"
type="de.vidsoft.bos.struts.service.impl.BOSPersonStateCastorJDO"
lazy="true" >
<sql name="PersonState" />
</field>
<field name="FirstName" type="string" >
<sql name="FirstName" type="varchar" />
</field>
<field name="LastName" type="string" >
<sql name="LastName" type="varchar" />
</field>
</class>
-----8<----------8<----------8<-----
The first table will be read within application startup and the entries
stored within an ArrayList.
If I create a new Person object, I set the PersonState with an Entry of
the ArrayList.
I validate the PersonState objects an they are the same.
If now I call db.create( Person object ) within the database a new
PersonState entry and a new Person entry will be create.
But I don't want a new PersonState entry; I need the primary key of the
PersonState within the tablerow PersonState of the new created Person
entry.
I've after the create transaction:
table: person_states
+-------------+------------------+-------------+
| PersonState | ShortDescription | Description |
+-------------+------------------+-------------+
| 1 | VALID | valid |
| 2 | DELETED | deleted |
| 3 | VALID | valid |
+-------------+------------------+-------------+
table: persons
+-------------+-------------+-----------+----------+
| BosPersonID | PersonState | FirstName | LastName |
+-------------+-------------+-----------+----------+
| 1 | 1 | Test1 | Test1 |
| 2 | 2 | test2 | Test2 |
| 3 | 3 | test3 | Test3 |
+-------------+-------------+-----------+----------+
I need after the create transaction:
table: person_states
+-------------+------------------+-------------+
| PersonState | ShortDescription | Description |
+-------------+------------------+-------------+
| 1 | VALID | valid |
| 2 | DELETED | deleted |
+-------------+------------------+-------------+
table: persons
+-------------+-------------+-----------+----------+
| BosPersonID | PersonState | FirstName | LastName |
+-------------+-------------+-----------+----------+
| 1 | 1 | Test1 | Test1 |
| 2 | 2 | test2 | Test2 |
| 3 | ->1<- | test3 | Test3 |
+-------------+-------------+-----------+----------+
What I'm doing wrong ?
The PersonState object implements Timestampable for long transactions.
P.S.: Sorry for my bad english.
mit freundlichen Gr��en / Kindest regards
--
Uwe Barthel ......... [EMAIL PROTECTED] ....... Tel: +49-351-4353400
VidSoft GmbH ........ http://www.vidsoft.de .... Fax: +49-351-4353428
seeing is believing . arena.vidconference.de .->.. [EMAIL PROTECTED]
GnuPG KeyID: 3DD904E7 ...............................................
Fingerprint: 74C3 B1E1 422F 8EEF FB70 BC0F B8FA BB46 3DD9 04E7 .....
*********************************************************************
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
*********************************************************************
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev