Hello,
Postgres allows for columns with arrays. I found several posts here and on the internet that show how to insert an array into the database.
However, I found nothing that allowed the creation of this SQL query in HQL
select * from TABLE where COLUMN[1] > 25;
Just to elaborate - that query, in Postgres, will return all rows that have the 1st element in COLUMN > 25.
We're using:
Hibernate 3.
No mapping xmls - purely annotated.
Query causing errors:
Code:
Query q = session.createQuery("from ASETest a where a.string[1] = 'a'");
This works fine.
Code:
Query q = session.createQuery("from ASETest ");
I'm assuming the
Code:
[]
mean something special because with them included, the query doesn't even compile, and I see a Class cast exception.
Code:
java.lang.ClassCastException: org.hibernate.type.CustomType
at org.hibernate.hql.ast.tree.DotNode.resolveIndeDotNode.java:179)
at org.hibernate.hql.ast.tree.IndexNode.resolve(IndexNode.java:63)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
Now, it might be that this can't be done with HQL, but does anyone have solutions or workarounds short of using SQL-JDBC?
The closest someone came to the same problem was this:
http://forum.hibernate.org/viewtopic.php?t=946973&highlight=postgres+array
Thanks.