0
我使用的原生查詢調用一個函數在我的PostgreSQL數據庫,代碼是這樣的:休眠+ JPA + PostgreSQL的:沒有dialet映射
String query = "select details,rec_xml[1] from f_get_reccomendations(\'/ma:recommendations/ma:recommendation/name/text()\') ORDER BY id DESC LIMIT 1;";
Query q = em.createNativeQuery(query);
return q.getResultList();
函數定義爲:
CREATE OR REPLACE FUNCTION f_get_reccomendations (
IN xpath varchar(128),
OUT id int,
OUT recs_num int,
OUT details varchar(25),
OUT d_stamp timestamp,
OUT rec_xml xml[]
) RETURNS SETOF RECORD AS
$$
select id, recs_num, details, d_stamp, xpath($1, recs,
array [
array['xs','http://www.w3.org/2001/XMLSchema'],
array['ma','http://schemas.medio.com/analytics/1.0']
]
) from recommendations;
$$
LANGUAGE SQL;
當它運行從psql,它的工作,但是當我在代碼中運行,它向我投擲錯誤: 沒有方言映射的JDBC類型:2009
我的猜測是rec_xml被定義爲xml []類型, rnate無法理解?我該如何解決它?謝謝