I have a criteria query not really working. Here the model:
@Entity
public class Flaw extends BaseEntity implements Serializable {
...
@Lob
@Basic(fetch=FetchType.LAZY)
private String text;
...
This query is going to be executed by hibernate (from Logs):
Hibernate:
select
...
flaw0_.text as col_7_0_,
...
from
Flaw flaw0_,
where
...
and (
flaw0_.text like ?
)
order by
flaw0_.text desc
But then I get the following 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
With oder properties it works fine, just with the like operator on the CLOB it is not working. Is this a Hibernate or Postgres problem? Or is this type of query not possible on CLOBs?
I am using:
- Hibernate 3.6.3
- PostgreSQL 8.4.8
- PostgreSQL 8.3 JDBC3 with SSL (build 603)
Any Ideas?
Update:
I did some further investigation:
- The above annotation creates correctly a
textpostgres type - If I run the sql query , that hibernate prints out, it works.
BR
Rene-
After trying around I found the following solution which worked for me. I had to add the following annotation, and now it works: