I've done some more debugging and it seems the problem is that SequenceManagerNativeImpl.afterStore() always gets called, even if the class does not have an autoincrement field. The reason I did not have this problem previously is that I was using a custom version of SequenceManagerMySQLImpl instead (sorry I had forgotten about this). I changed SequenceManagerNativeImpl.afterStore() to the following and all is working now:
public void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object obj) throws SequenceManagerException
{
FieldDescriptor fd = cld.getAutoIncrementField();
if (fd == null) {
if (log.isDebugEnabled()) {
log.debug("Class does not have an autoincrement field, skipping: " + cld);
}
} else {
long newId = getLastInsert(cld);
setFieldValue(obj, fd, new Long(newId));
}
}
Thanks,
Mike
On Wednesday, August 20, 2003, at 07:23 PM, Armin Waibel wrote:
> Hi Michael, > >> - Inserting an object that does not have an autoincrement field > hmm, changes were made to SequenceManagerNativeImpl last 10 days, > but no changes in detecting autoincrement fields. Each pk field must > be set before storing or need an autoincrement attribute (set 'true') > in > field-descriptor (default was 'false'). > > regards, > Armin >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
