Dataset had missing column. In some techniques no column definition inserts empty to column in question, so it missled me.
An attempt to place a null value in a non-nullable datatype
题
I'm using dbunit and unitils trying to get test sensitive dates on my dataset files.
public void setUp() {
String dataSetFile = "/Dataset.xml";
IDataSet dataSet;
try {
dataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile));
rDataSet = new ReplacementDataSet(dataSet);
rDataSet.addReplacementObject("[var1]", TestDates.getDatasetDate(2));
rDataSet.addReplacementObject("[var2]", DateUtils.addDays(new Date(), 3));
rDataSet.addReplacementObject("[var3]", DateUtils.addDays(new Date(), 1));
DatabaseOperation.CLEAN_INSERT.execute(getConnection(), rDataSet);
@Test....
The problem is when running this I get error
An attempt to place a null value in a non-nullable datatype.
Dataset:
<?xml version="1.0" encoding="UTF-8"?>
<table id="1720"
var1="[var1]"
var2="[var2]"
somedate="2013-02-25 08:00:00"
var3="[var3]"
/>
</dataset>
What's the fix? Is it somewhere in date formating? Or database itself? Its Ingres.
解决方案
不隶属于 StackOverflow