[ rubbish-db ]

ソース

RubbishDatabase dbh = new RubbishDatabase(new HsqldbExceptionFactory());
dbh.setLogging(true);

dbh.connect("jdbc:hsqldb:hsql://localhost", "sa", "");

Publisher publisher = new Publisher();
publisher.setId("07");
publisher.setName("御来利意書房");
publisher.setVolumes(null);
publisher.setUpdate_date(new Date());
publisher.setCreate_date(new Date());

try {
    dbh.insert(publisher);
} catch (SQLNotNullException e) {
    System.out.println(e);
}

dbh.rollback();
dbh.disconnect();

結果

connect database 'url=jdbc:hsqldb:hsql://localhost, user=sa, password='.
'INSERT INTO PUBLISHER (CREATE_DATE, ID, NAME, UPDATE_DATE, VOLUMES) VALUES (?, ?, ?, ?, ?) [2005-09-11 11:04:44.539, 07, 御来利意書房, 2005-09-11 11:04:44.539, null]'
rubbish.db.exception.SQLNotNullException: java.sql.SQLException: Attempt to insert null into a non-nullable column: column: VOLUMES table: PUBLISHER in statement [INSERT INTO PUBLISHER (CREATE_DATE, ID, NAME, UPDATE_DATE, VOLUMES) VALUES (?, ?, ?, ?, ?)] (error code=-10, SQLState=23000, SQL='INSERT INTO PUBLISHER (CREATE_DATE, ID, NAME, UPDATE_DATE, VOLUMES) VALUES (?, ?, ?, ?, ?) [2005-09-11 11:04:44.539, 07, 御来利意書房, 2005-09-11 11:04:44.539, null]')
rollback transaction.
disconnect database.