statement « HQL « JPA Q&A





1. HQL "Contains" statement howto?    stackoverflow.com

I have an entity that has a string property called Tags. I would like to query this entity based upon if a certain string is located in Tags property. So for example, ...

2. How to construct these HQL statements    stackoverflow.com

Do anyone know how to construct these two SQL statement in HQL;

     SELECT MIN(id) FROM Books WHERE mid < ?  OR mid =?

    ...

3. Basic HQL statement always fails    stackoverflow.com

I've recently started trying to use Hibernate, but am doing so in Netbeans. This has left me having to use this example project to try and get me ...

4. "IN" statement in play using hql    stackoverflow.com

How can I write hql query like same sql query like this "select * from Users u where u.id in (1, 3, 4)"

5. Case .. when statements in HQL    coderanch.com

Hi, I have to implement a SQL query (with case when stmt) in HQL. HQL documentation says that HQL supports the case when statement. But when i converted the query to HQL, it gives me errors .. Here is the query: select prod, case when length(prod.category) > 0 then prod.category when length (prod.iTax.icCategoryId) > 0 then (select pt.portalPcategoryName from Products p ...

6. Help with HQL statement    coderanch.com

Hi all- I have a database that is being used as a sort of version control system. That is, instead of ever updating any rows, I add a new row with the same information. Each row also contains a version column that is a date timestamp, so the only difference is the new row will have a more recent timestamp. Each ...

7. Simple HQL statement not working !?    forum.hibernate.org

Hi, I have a simple HQL query statement that I expect to work with no problem but I just could not get thru this queryException. I hope extra pair of eyes can help spot my wrong doings right away. Cause of Exception: org.hibernate.QueryException: Not all named parameters have been set: [conId] [SELECT Consumer FROM Consumer AS consumer WHERE consumer.conId = :conId] ...

8. HQL statement one-to-many - need some help    forum.hibernate.org

Got a newbie HQL/SQL question for you all. I have the following HQL statement select count(ID) from Asset as asset where asset.StateInfo.MobileProvider.Name='Vodafone' The Asset->StateInfo reference is one-to-many and the rest are one-to-one. This query generates a QueryException: org.hibernate.QueryException: illegal attempt to dereference collection [asset0_.`id`.StateInfo] with element property reference [MobileProvider] [select count(ID) from Asset as asset where asset.StateInfo.MobileProvider.Name='Vodafone'] I'm sure this is ...

9. Why does the HQL-statement not work.    forum.hibernate.org





10. ANSI CASE statement in HQL    forum.hibernate.org

Hi i need to use CASE statement or DECODE is the select part of my query, is there any way to do this. the reason being that i need to return a diferent column depending on the value of another. I just get the undefined alias error when trying to use either. as we are using HQL for all other queries ...

11. How to write HQL with this statement    forum.hibernate.org

String query = "select {profile_.*}, count(message.userID) as i from Forum forum_ inner join ForumMessage message on message.forumID=forum_.forumID " + " inner join profile {profile_} on message.userID={profile_}.id" + " group by message.userID order by i desc "; I use the statement : Query hibernateQuery = session.createSQLQuery(query, "profile_", Profile.class); to execute the query, cause it seems I can not give an alias to ...

12. HQL in statement    forum.hibernate.org

Hi, is it possible to query for parts of a class in an in statement with hql? For example class A has fields a, b and c. I would like hibernate to build this query: select * from A where (A.a, A.b) in ((a1, b1), (a2, b2), ...) Can I do this without a special mapping for A.a and A.b? Greetings, ...