以下を使用して、DB にレコードを挿入しています。
        PreparedStatement stmt = null;
        Connection conn = null;
        HashMap<String, Object> hoursMap = new HashMap<String, Object>();
        hoursMap.put("PLACE_ID", hours.getPlaceID());
        hoursMap.put("DAY", hours.getDayID());
        hoursMap.put("TIME_OPEN", hours.getTimeOpen());
        hoursMap.put("TIME_CLOSE", hours.getTimeClose());
        String insertStr = StatementCreator.insertQueryGenerator("HOURS",
                hoursMap);
        try {
            conn = ConnectionManager.getConnection();
            stmt = StatementCreator.createStatement(conn, insertStr, hoursMap,
                    false);
            returnVal = stmt.execute();
            ConnectionManager.closeStatement(stmt);
            System.out.println("Created");
        } catch (SQLException e) {
            System.out.println("ERROR");
            e.printStackTrace();
        } finally {
            ConnectionManager.closeConnection(conn);
        }
        return returnVal;
    }
ただし、これを実行すると、次のエラーが発生します。
org.postgresql.util.PSQLException: エラー: 列 "TIME_OPEN" はタイム ゾーン付きの time 型ですが、式は可変型の文字
です ヒント: 式を書き直すか、キャストする必要があります。ポジション: 71
私が理解できないのはなぜですか?私がそう言う理由は、デバッグモードに入り、内部の準備されたステートメントを見ると、次のように表示されるからです。
INSERT INTO "HOURS" ("TIME_OPEN","DAY","TIME_CLOSE","PLACE_ID")VALUES('11:30:00-0400',6,'23:59:59-0400',541)
これをコピーして SQL エディターに貼り付けると、実行されてレコードが挿入されます。
足りないものはありますか?