[英]Hibernate Criteria Query like operator on CLOB (Postgres 8.4)
我有一個標准查詢無法正常工作。 這里是模型:
@Entity
public class Flaw extends BaseEntity implements Serializable {
...
@Lob
@Basic(fetch=FetchType.LAZY)
private String text;
...
這個查詢將由休眠(從日志)執行:
Hibernate:
select
...
flaw0_.text as col_7_0_,
...
from
Flaw flaw0_,
where
...
and (
flaw0_.text like ?
)
order by
flaw0_.text desc
但是然后我得到以下StackTrace:
3171 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 42883
3171 [main] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: operator does not exist: text ~~ bigint
3198 [main] INFO org.hibernate.impl.SessionFactoryImpl - closing
使用oder屬性,它可以很好地工作,就像在CLOB上使用like運算符一樣,它不起作用。 這是Hibernate還是Postgres問題? 還是在CLOB上無法進行這種查詢?
我在用:
有任何想法嗎?
更新:我做了一些進一步的調查:
text
postgres類型 BR
Rene-
經過嘗試后,我發現以下對我有用的解決方案。 我必須添加以下注釋,現在它可以工作:
@Type(type = "org.hibernate.type.TextType")
由於您的Postgres版本完全支持CLOB,因此這似乎是不可能的: http : //www.postgresql.org/docs/8.4/interactive/unsupported-features-sql-standard.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.