Skip to content
Snippets Groups Projects
Commit d2b5b2d7 authored by felmer's avatar felmer
Browse files

LMS-1995 strange bug concerning update with data set size = null fixed

SVN: 19882
parent 156530d1
No related branches found
No related tags found
No related merge requests found
......@@ -363,12 +363,23 @@ final class ExternalDataDAO extends AbstractGenericEntityWithPropertiesDAO<Exter
Long fileFormatTypeID = externalData.getFileFormatType().getId();
char complete = externalData.getComplete().name().charAt(0);
Long storageFormatTermID = externalData.getStorageFormatVocabularyTerm().getId();
executeUpdate(
"insert into "
+ TableNames.EXTERNAL_DATA_TABLE
+ " (data_id, share_id, location, size, loty_id, ffty_id, is_complete, cvte_id_stor_fmt) "
+ "values (?, ?, ?, ?, ?, ?, ?, ?)", id, shareId, location, size,
locatorTypeID, fileFormatTypeID, complete, storageFormatTermID);
if (size == null)
{
executeUpdate(
"insert into "
+ TableNames.EXTERNAL_DATA_TABLE
+ " (data_id, share_id, location, loty_id, ffty_id, is_complete, cvte_id_stor_fmt) "
+ "values (?, ?, ?, ?, ?, ?, ?)", id, shareId, location,
locatorTypeID, fileFormatTypeID, complete, storageFormatTermID);
} else
{
executeUpdate(
"insert into "
+ TableNames.EXTERNAL_DATA_TABLE
+ " (data_id, share_id, location, size, loty_id, ffty_id, is_complete, cvte_id_stor_fmt) "
+ "values (?, ?, ?, ?, ?, ?, ?, ?)", id, shareId, location, size,
locatorTypeID, fileFormatTypeID, complete, storageFormatTermID);
}
hibernateTemplate.evict(loaded);
}
hibernateTemplate.update(externalData);
......
......@@ -155,7 +155,18 @@ public final class ExternalDataDAOTest extends AbstractDAOTest
}
@Test
public void testUpdateDataSetAquiredFromSample()
public void testUpdateDataSetAquiredFromSampleWithoutDataSetSize()
{
checkUpdate(null);
}
@Test
public void testUpdateDataSetAquiredFromSampleWithDataSetSize()
{
checkUpdate(4711L);
}
private void checkUpdate(Long size)
{
IExternalDataDAO externalDataDAO = daoFactory.getExternalDataDAO();
DataPE data = new DataPE();
......@@ -180,7 +191,7 @@ public final class ExternalDataDAOTest extends AbstractDAOTest
externalData.setLocatorType(pickALocatorType());
externalData.setLocation("abcd");
externalData.setShareId("share-42");
externalData.setSize(4711L);
externalData.setSize(size);
externalData.setComplete(BooleanOrUnknown.U);
externalData.setStorageFormatVocabularyTerm(pickAStorageFormatVocabularyTerm());
externalData.setPlaceholder(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment