Opened 5 years ago

Closed 5 years ago

#2191 closed defect (fixed)

Batch item importers fail in create+update mode if an item already exists

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.15.2
Component: coreplugins Version:
Keywords: Cc:

Description

When running a batch importer in create+update mode, the expected behavior is that existing items should be updated. Instead an error message:

net.sf.basedb.core.BaseException: Item already exists: Tag[Name=BDC7001-BDC5001] on line 226 in file 'barcodes_and_templates.xlsx': BDC7001-BDC5001  A...
  at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:733)
  at net.sf.basedb.plugins.AbstractFlatFileImporter.run(AbstractFlatFileImporter.java:466)
  at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:117)
  at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:574)
  at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: net.sf.basedb.core.ItemAlreadyExistsException: Item already exists: Tag[Name=BDC7001-BDC5001]
  at net.sf.basedb.plugins.batchimport.AbstractItemImporter.handleData(AbstractItemImporter.java:837)
  at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:698)
  ... 4 more

The only workaround seems to be to run the import two times, first in update-only mode and then in create-only mode.

Change History (2)

comment:1 by Nicklas Nordborg, 5 years ago

It seems to be a bug that was introduced when implementing #2150 in [7594].

comment:2 by Nicklas Nordborg, 5 years ago

Resolution: fixed
Status: newclosed

In 7742:

Fixes #2191: Batch item importers fail in create+update mode if an item already exists

The "item exists" check should not fail in "update" mode.

Note: See TracTickets for help on using tickets.