Opened 13 years ago

Closed 13 years ago

#1658 closed defect (fixed)

Batch importers fail to associate items with parent items

Reported by: Jari Häkkinen Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 3.0.2
Component: web Version:
Keywords: Cc:

Description

The batch importer fails when I try to connect sample sources of subtype 'Case' to biosource items of subtype 'No'. I run the importer in 'update' only mode.

The stack trace:

net.sf.basedb.core.BaseException: failed to lazily initialize a collection of role: net.sf.basedb.core.data.ItemSubtypeData.relatedSubtypes, no session or session was closed on line 2 in file 'CASE_ConsentNotAsked.csv': 14067 1106272 Not...
at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:708)
at net.sf.basedb.plugins.AbstractFlatFileImporter.run(AbstractFlatFileImporter.java:445)
at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:116)
at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:510)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: net.sf.basedb.core.data.ItemSubtypeData.relatedSubtypes, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)
at org.hibernate.collection.AbstractPersistentCollection.readElementByIndex(AbstractPersistentCollection.java:176)
at org.hibernate.collection.PersistentMap.get(PersistentMap.java:169)
at net.sf.basedb.core.ItemSubtype.getRelatedSubtype(ItemSubtype.java:497)
at net.sf.basedb.core.ItemSubtype.getRelatedSubtype(ItemSubtype.java:175)
at net.sf.basedb.plugins.batchimport.SampleImporter.updateItem(SampleImporter.java:338)
at net.sf.basedb.plugins.batchimport.SampleImporter.updateItem(SampleImporter.java:52)
at net.sf.basedb.plugins.batchimport.AbstractItemImporter.handleData(AbstractItemImporter.java:754)
at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:676)
... 4 more

Change History (3)

comment:1 by Nicklas Nordborg, 13 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

I think the error is caused by selecting exactly one subtype for the 'Item subtypes' parameter. Selecting 0 or >= 2 options should work as a temporary workaround. This will of course cause the function that assigns the selected subtype to new items to stop working, but this can also be done by mapping the 'Item subtype' column mapping to a constant value (the name of the desired subtype).

comment:2 by Nicklas Nordborg, 13 years ago

Summary: Batch importer fails to associate sample items to parent biosource itemsBatch importers fail to associate items with parent items

The problems was simple to fix and affects all batch importers when all of the following are true:

  1. A single subtype has been selected for the 'Item subtypes' parameter
  2. A mapping has been provided for a column that links to other items that can also have a subtype (eg. a parent item, a protocol, etc.).
  3. No mapping has been specified for the 'Item subtype' column mapping.

comment:3 by Nicklas Nordborg, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [5930]) Fixes #1658: Batch importers fail to associate items with parent items

I have added a test case for this issue to the Sample importer.

Note: See TracTickets for help on using tickets.