Hi *,
we have a strange problem with CASTOR as persistence manager.
We use a access="shared" in our mapping file.
In our webApp (tomcat 4.1.2) I'm loading an Object through CASTOR from our
DB.
I change values, UPDATE the object: everything works fine.
I close the browser.
I open a new browser, load the same Object from DB (everything is fine so
long, I can see my recent changes),
but when I try to UPDATE the Object again I get the well known
ObjectModifiedException: Timestamp mismatch!
The only way I can make things run again is to restart my tomcat.
By the way the timestamp is saved as a property onto the Object itself and
transported to and from the client via hidden fields.
Nothing uncommon I guess.
For me it looks like Castor is not closing the (long) transactions!?
Who knows more, who can help?
Here is the core of the mapping file.
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
1.0//EN"
"http://castor.exolab.org/mapping.dtd">
<mapping>
<class name="de.kvb.bms.model.Klientin" identity="screeningId"
access="shared">
<map-to xml="Klientin" table="MAMMOOWNER2.KLIENTIN"/>
<field name="screeningId" type="string">
<bind-xml name="SCREENING_ID"/>
<sql dirty="ignore" name="SCREENING_ID"
type="varchar"/>
</field>
...
</class>
</mapping>
And here is the simple java test I use.
-- snip --
public void testSaveLoad()
throws Exception
{
// uses an oql query to get an object
Bildassessment ba_2 =
BildassessmentDBManager.getInstance().loadByUs(us.getId());
ba_2.setLokalisation1("X2");
ba_2.setSText("STEXT1");
ba_2.setGgText("GGTEX1");
log.debug("### ba_2["+ba_2.jdoGetTimeStamp()+"]");
// first update ####
BildassessmentDBManager.getInstance().update(ba_2);
// -->every things works fine
for (int i=0; i<100000000; i++){
// wait to check if timestamp changes
}
// second update ####
Bildassessment ba_3 =
BildassessmentDBManager.getInstance().loadByUs(us.getId());
ba_3.setLokalisation1("Y0");
log.debug("### ba_3["+ba_3.jdoGetTimeStamp()+"]");
BildassessmentDBManager.getInstance().update(ba_3);
//--> fails with ObjectModifiedException: Timestamp mismatch!
}-- snap --
And here is the log file, notice that the timestamp value is identical for
the first loaded and the second loaded Object:
-- snip --
[2003-10-29 08:14:16,500 DEBUG] BildassessmentDBManager (main ) >
[BMS_CASTOR] Castor: Loading de.kvb.bms.model.Bildassessment (1)
[2003-10-29 08:14:16,500 DEBUG] BildassessmentDBManager (main ) >
[BMS_CASTOR] Castor: Storing de.kvb.bms.model.Bildassessment (1)
[2003-10-29 08:14:16,590 DEBUG] AbstractBefundDBManagerTestCase (main ) >
### ba_2[1067411656560]
[2003-10-29 08:14:16,590 DEBUG] BildassessmentDBManager (main ) >
###db.isActive() [true]
[2003-10-29 08:14:16,590 DEBUG] BildassessmentDBManager (main ) >
###db.isClosed() [false]
[2003-10-29 08:14:16,600 DEBUG] BildassessmentDBManager (main ) >
###db.isPersistent() [false]
[2003-10-29 08:14:16,600 DEBUG] BildassessmentDBManager (main ) > ###
TimeStamp before update[1067411656560]
[2003-10-29 08:14:16,600 DEBUG] BildassessmentDBManager (main ) >
[BMS_CASTOR] Castor: Storing de.kvb.bms.model.Bildassessment (1)
[2003-10-29 08:14:17,711 INFO ] BildassessmentDBManager (main ) > load
Bildassessment with usid=[-1]
[2003-10-29 08:14:17,721 DEBUG] BildassessmentDBManager (main ) >
[BMS_CASTOR] SELECT ... )
[2003-10-29 08:14:17,962 DEBUG] BildassessmentDBManager (main ) >
[BMS_CASTOR] Castor: Loading de.kvb.bms.model.Bildassessment (1)
[2003-10-29 08:14:17,972 DEBUG] AbstractBefundDBManagerTestCase (main ) >
### ba_3[1067411656560]
[2003-10-29 08:14:17,972 DEBUG] BildassessmentDBManager (main ) >
###db.isActive() [true]
[2003-10-29 08:14:17,972 DEBUG] BildassessmentDBManager (main ) >
###db.isClosed() [false]
[2003-10-29 08:14:17,972 DEBUG] BildassessmentDBManager (main ) >
###db.isPersistent() [false]
[2003-10-29 08:14:17,972 DEBUG] BildassessmentDBManager (main ) > ###
TimeStamp before update[1067411656560]
[2003-10-29 08:14:17,972 ERROR] BildassessmentDBManager (main ) >
PersistenceException in update: Timestamp mismatched!
-- snap --
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev