Hello,

I am currently trying to solve a problem with castor throwing above 
exception for an update (long transaction).

The main course of events is:

...
Integer id = new Integer(24);
db.begin();
MyClass x = db.load(MyClass.class,id);
db.commit();
...
// this works
x.setState(UNCONFIRMED);
db.begin();
db.update(x);
db.commit();

// do something else
db.begin();
OQLQuery oql = db.getOQLQuery("SELECT o FROM my.objects.Another o 
WHERE reference = $1");
oql.bind(x);
QueryResults results = oql.execute();
int sum = 0;
while (results.hasMore()) {
 Another y = (Another)results.next();
 sum += y.getAmount();
}
results.close();
db.commit();

// later
// this does not work anymore
x.setState(CONFIRMED);
db.begin();
db.update(x);
db.commit();

Mapping:
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 
1.0//EN"
                           "http://castor.exolab.org/mapping.dtd";>
<mapping>
[...]
<class name="my.objects.BaseClass" 
 identity="id">

 <map-to table="BaseTable" />

 <field name="id" type="integer">
  <sql name="id" type="integer" />
 </field>
</class>

<class name="my.objects.MyClass" 
 extends="my.objects.BaseClass" 
 identity="id">

 <map-to table="MyTable" />

 <field name="id" type="integer">
  <sql name="id" type="integer" />
 </field>

</class>

<class name="my.objects.Another" 
 identity="id">

 <map-to table="AnotherTable" />

 <field name="id" type="integer">
  <sql name="id" type="integer" />
 </field>

 <field name="reference" type="my.objects.BaseClass">
  <sql name="invoice" />
 </field>

 <field name="amount" type="integer">
  <sql name="amount" type="integer" />
 </field>

</class>

It seems the problem is the selected objects instantiates another 
MyObject with the same id. I can see storing the instance during 
commit() with following DEBUG:
Castor: Storing my.objects.BaseClass (24)

but I don't know why, as the row in the data base is unchanged

Any hints are appreciated.

Bernd
Mit freundlichen Gr��en

Bernd Laengerich
-- 
act'o-soft GmbH Informationssysteme  Tel. +49-5203-974440
Enger Stra�e 12                      Fax: +49-5203-974441
D-33824 Werther (Westf.)             http://www.actosoft.de
HRB 2612  GF: Christian Malachowski, Dipl.-Ing. Michael Schramm
---------------------------------------------------------------------
This e-mail including any attachments may contain information that is
legally privileged and confidential. It constitutes non-public 
information intended to be conveyed only to the designated  
recipient(s). If you are not an intended recipient please delete this
e-mail and any attachments and do not read, copy, or retransmit it 
and please notify act'o-soft GmbH by return mail, e-mail or 
at +49/5203/974440. 
The unauthorized use, dissemination, distribution or reproduction of 
this e-mail, including attachments, is prohibited and may be 
unlawful.
---------------------------------------------------------------------

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to