###実現したいこと
・Spring Boot
・Postgres SQL
・MyBatis
以上3点を使用した環境における質問です。
Postgres SQLのとあるテーブルで、 xml型 のカラムがあるのですが、
これはドメインオブジェクト側ではどのような型宣言をすべきなのでしょうか。
もしくは全く違ったアプローチが必要なのでしょうか?
###発生している問題・エラーメッセージ
Caused by: org.springframework.jdbc.BadSqlGrammarException:
Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: column "analysis" is of type xml but expression is of type character varying
ヒント: You will need to rewrite or cast the expression.
ポジション: 73
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: INSERT INTO usd_jpy_prices (timestamp, price, analysis) VALUES (?, ?, ?)
Cause: org.postgresql.util.PSQLException: ERROR: column "analysis" is of type xml but expression is of type character varying
ヒント: You will need to rewrite or cast the expression.
ポジション: 73
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: column "analysis" is of type xml but expression is of type character varying
ヒント: You will need to rewrite or cast the expression.
ポジション: 73
###該当のソースコード
Java
1// DBの1テーブルに対応したドメインオブジェクトです 2@Data 3public class UsdJpyPriceBean { 4 5 private Date date; 6 private BigDecimal price; 7 8 // ここの型はPostgres側では xml 型なのです 9 private String indexDoc; 10}
###試したこと
XML を toStringして格納しようとしたが当然上記のエラーが吐き出されます。
###補足情報(言語/FW/ツール等のバージョンなど)
・Spring Boot
・Postgres SQL
・MyBatis
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/28 02:56