Hi!
I've spent now 5h on finding out the following behaviour:
There is a significant difference between storing new objects and storing existing but
edited objects.
The latter seems to work only if properties are edited between the transaction
beginning and the commitment. Right??
I wanted to use the following method in a singleton ControlClass.
public void store(Object toBeStored) {
Database db = odmg.getDatabase(null); // the current DB
Transaction tx = null;
tx = odmg.newTransaction();
tx.begin();
tx.lock(toBeStored, tx.WRITE);
tx.commit();
}
So in one case I put in a newly created Object (OID==0 ?) and in another case its an
object that I retrieve from DB to change some properties.
The first case works fine, but in the second I just get the following:
[org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: getObjectByIdentity
de.itconcept.bbs.server.company.data.Address{21}
But there is no UPDATE executed against the DB.
Sometimes (!) its followed by a debug output about what SELECT statement was used for
getting an Address.
What can I do?? I'dont want to move the transaction outside of the store function. Are
there possibilities to store Objects without beginning and comitting transactions?
Can I use an alternative method than tx.lock(toBeStored,tx.WRITE) ?
Why does db.makePersistent(toBeStored) does'nt work either?
Thank You all for helping
Walid