Guido Beutler wrote:
Hello,
I updated from RC5 to RC6. I am using OJB inside of JBoss 3.2.3 with DB2 V8.
Since update to RC6 OJB generates a insert for every stored object when using PB API.
OJB seems not to check if the object exists at database. If the object already exist,
a SQL Exception is thrown. (-803 which means dublicated PK). If I try to insert the same object
several times, every time the same exception is thrown. If I select the object first, OJB generates a insert too.
I tried the same with RC5 (just to be sure that it is not a error at the test case) and RC5 works as expected.
If the object exist a update is generated.
Did I miss something or is it a new issue?
hmm, in PBImpl we do:
ClassDescriptor cld = getClassDescriptor(obj.getClass()); /* if one of the PK fields was null, the objects was new and needs insert */ boolean doInsert = serviceBrokerHelper().hasNullPKField(cld, obj); //if one of the PK field represents 'null' OJB assume the object is new Identity oid = new Identity(obj, this, cld);
/*
if the object has been deleted during this transaction,
then we must insert it
*/
boolean shouldRemoveFromDeleted = false;
if (!doInsert)
{
doInsert = deletedDuringTransaction.contains(oid);
shouldRemoveFromDeleted = true;
}/*
if PK values are set, lookup cache or db to see whether object
needs insert or update
*/
if (!doInsert)
{
doInsert = objectCache.lookup(oid) == null
&& !serviceBrokerHelper().doesExist(cld, oid, obj);
}
// now store it:
store(obj, oid, cld, doInsert);Which of these methods returns a wrong result?
regards, Armin
best regards,
Guido
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
