実際、私の質問全体はタイトルにあります。Invoice-Objects の Sqlite DB への挿入と削除を管理するクラスがあります。
public class Invoice {
private String str1;
private Float flt1;
private String str2Null;
private Float flt2Null;
public Invoice(String str1, Float flt1){
this.str1 = str1;
this.flt1 = flt1;
}
getters & setters...
}
public class InvoiceManager{
...Konstruktor...
public int insertInvoice(Invoice invoice) throws Exception{
try {
PreparedStatement stmt = databaseConnection.prepareStatement(
"INSERT INTO invoice (str1, flt1, str2Null, flt2Null) VALUES (?,?,?,?)");
stmt.setString(1, invoice.getStr1());
stmt.setFloat(2, invoice.getFlt1());
stmt.setString(3, invoice.getStr2Null());
stmt.setFloat(4, invoice.getFlt2Null());
....
したがって、DB に sth を挿入し、Str2Null = null を挿入したい場合、それは機能し、sqliteDB に NULL を書き込みますが、Flt2Null = null を使用すると、例外が発生します...なぜ誰かが私に言うことができますか??? 今まで助けてくれてありがとう...