> returns true for my SMALLINT objects if the value is 0. But 0 is a > leagal value for SMALLINT PK attributes.
Gotcha! Do you have declared the SMALLINT field as primitive field in your object and declare this field as PK in class-descriptor? In that case OJB assume the field represents 'null' (default value of primitive number fields). OJB needs to represent a nullified field for primitive fields, we take value '0' to do that job.
regards, Armin
Guido Beutler wrote:
Guido Beutler wrote:
Armin Waibel wrote:
do you use anonymous keys? If so where?
>> Do you remember our DataSource problem with 3.2.2.RC3 with missing >> results?
No, can you describe this problem again? Should I update to JBoss 3.2.3 and run the tests again?
we had the problem, that not all objects were returned by OJB. This seemed to be a side effect of the eager-release
flag. After Update to JBoss 3.2.3 the problem disapeared. Maybe that the bahavior of our current problem is different
in 3.2.3.
I'll put some debug gcode into PersistenceBroker and see what's going on during insert/update.
best regards,
Guido
Hi,
I added some debug code to
PersistenceBrokerImpl :
public void store(Object obj) throws PersistenceBrokerException {
...
boolean doInsert = serviceBrokerHelper().hasNullPKField(cld, obj);
returns true. The reason seems to be BrokerHelper.representsNull :
public boolean representsNull(FieldDescriptor fld, Object aValue)
{
.....
if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0)))
{
result = fld.getPersistentField().getType().isPrimitive() && fld.isPrimaryKey();
}
....
return result;
}
returns true for my SMALLINT objects if the value is 0. But 0 is a leagal value for SMALLINT PK attributes.
After that PersistenceBrokerImpl.store checks the cache:
/* 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); }
because of doInsert is still true (I checked it) The cache is never checked for the object. doInsert is still true and
a few lines later
// now store it: store(obj, oid, cld, doInsert);
generates the insert statement. Maybe I'm wrong but for me it looks like a 0 (not null) at any PK field causes a insert statement.
In my case it is immediately the first object. Is it a good idea to check the cache independent if doInsert is true or is the implementation
of representsNull the cause and should be changed ?
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]
