condition « HQL « JPA Q&A

1. multiple IN conditions in JPQL

How can I express the following SQL in JPQL:

select * from table where 
( ( table.col1 , table.col2) in 
   (col1val1, col2val1),
   (col1val2, col2val2),
   (col1val3, ...

2. How to use subselect HQL in a Hibernate filter condition?

I want to use Hibernate's filters, to filter "MyEntity" objects, using a suselect of "AnotherEntity" in the filter condition. The configuration looks something like this:


  <filter-def name="myFilter" condition="someProperty in (select ...

3. HQL CASE statement usage

I'm using HQL and have this query

<query name="">
        FROM rule.myRule as cr
        WHERE ...

4. Conditional operator in HQL

Is it possible to express in HQL a conditional operator similar to PostgreSQL's CASE ... WHEN ... ELSE ... END operator? I've checked the sources - Hibernate seems to use CaseFragments for internal purposes, but does not expose this functionality in HQL. Is the statement above correct? What would be the easiest way to implement conditional operator in a HQL query? ...

5. hql logical condition translation problem

Hello Everybody! I've been using Hibernate for a while now, but this is my first posting to this forum. Hiberante is great, thank you! :) Still, I have a problem. I'm trying to execute an HQL query which has subqueries. The generated SQL seems to be wrong. Hibernate version: 3.2.CR2, 3.1 Code between sessionFactory.openSession() and session.close(): String q = "from table1 ...