문제

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.

도움이 되었습니까?

해결책

Dataset had missing column. In some techniques no column definition inserts empty to column in question, so it missled me.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top