1. How do I write a HQL Query for this? stackoverflow.comI want a single HQL query that returns all groups containing a given user that where created before a given date. Somehow I can't get it right.
| ||||||||||||||||||||||||||||||||
2. HQL query equivalence: Why are them different stackoverflow.comHi I have a working HQL query which I want to optimize. It is as follows:
| ||||||||||||||||||||||||||||||||
3. Proper way of writing a HQL in ( ... ) query stackoverflow.comAssuming that I want to write the following HQL query:
what is the proper way of writing this as a parametrized query, e.g.
| ||||||||||||||||||||||||||||||||
4. HQL and one-to-many queries stackoverflow.comI have Hibernate domain objects that looks like this:
| ||||||||||||||||||||||||||||||||
5. How do you do a limit query in HQL stackoverflow.comIn Hibernate 3, is there a way to do the equivalent of the following MySql limit in HQL.
I don't want to ... | ||||||||||||||||||||||||||||||||
6. HQL query, how to? stackoverflow.comI am working query with little idea of what software I am dealing with and minimum knowledge HQL. What I am looking is,
But ... | ||||||||||||||||||||||||||||||||
7. Hibernate HQL query - complicated stackoverflow.comI need to write some HQL to do the following... I have 3 tables: club, team and game (column names below) =School= -id(pk) -name =Team= -id(pk) -name -club_id(fk) =Game= -id(pk) -opposition -homeScore -awayScore -team_id(fk) I need to select the last 20 games played for a ... | ||||||||||||||||||||||||||||||||
8. Working with Hibernate Queries stackoverflow.comI am new to hibernate queries, and trying to get a grasp on how everything works. I am using Hibernate 3 with Netbeans 6.5. I have a basic project set up and ... | ||||||||||||||||||||||||||||||||
9. Whats wrong with this HQL query? stackoverflow.comdid i encounter a hibernate bug or do i have an error i dont see:
| ||||||||||||||||||||||||||||||||
10. hql query formation stackoverflow.comI want to construt a hql query like
I am doing in this way ... | ||||||||||||||||||||||||||||||||
11. Java Hibernate HQL queries with nolock stackoverflow.comIs there a way to run these queries as if I added a (NOLOCK) hint to them? | ||||||||||||||||||||||||||||||||
12. How to make an optimal hibernate query with three objets? stackoverflow.comI have a query but I dont know how to make it optimal. I have three objects.
| ||||||||||||||||||||||||||||||||
13. Using cfqueryparam with a ColdFusion HQL query stackoverflow.comI am using a HQL query to get a bunch of state objects like so:
| ||||||||||||||||||||||||||||||||
14. HQL JoinTable not accessible stackoverflow.comi have a many to many relationship between media and tags: Medium:
| ||||||||||||||||||||||||||||||||
15. Query for existance in HQL efficiently stackoverflow.comI have a class
| ||||||||||||||||||||||||||||||||
16. HQL Query Based on Set Contents stackoverflow.comI have a hibernate managed POJO with a set:
| ||||||||||||||||||||||||||||||||
17. Sum Of Two Queries HQL stackoverflow.comI have two tables, Ticket and Job, and both have a ClientId field and a TimeSpent field. I'm using HQL and can get the sum of TimeSpent from one table but I ... | ||||||||||||||||||||||||||||||||
18. After a few same hql query the application freezes stackoverflow.comI am calling below function with the same batchNumber and it is working without problem 15 times and takes the records from database without problem but at 16. time the ... | ||||||||||||||||||||||||||||||||
19. HQL query ignoring accents stackoverflow.comI've the following query:
How this would be, but ignoring the accents in u.name and ?1 ?
Thanks guys!
| ||||||||||||||||||||||||||||||||
20. Parsing an HQL query stackoverflow.comGiven an Hql query, I'd like to parse it to get a list of the entities that are being queried:
e.g. | ||||||||||||||||||||||||||||||||
21. Hibernate creates more than one query from hql query stackoverflow.comI am having a strange effect that hibernate fires more than one query when executing a specific hql query. At moment i use hsqldb 1.8 for development.
| ||||||||||||||||||||||||||||||||
22. HQL Query window - invalid query? forums.netbeans.orgBudfudder Joined: 09 Jul 2010 Posts: 2 Posted: Fri Jul 09, 2010 1:07 am Post subject: HQL Query window - invalid query? I'm developing an app using Hibernate ... | ||||||||||||||||||||||||||||||||
23. unable to write hql query for hibernate!! forums.netbeans.orghi all, First of all thanks for the hibernate tutorial. While completing the tutorial instead of sakila i used a custom db named invidb. i followed all the steps and after that wherein it was stated to test the connection by typing in the editor as from Actor, i typed from urlblacklist(it is the table in the db invidb) the error ... | ||||||||||||||||||||||||||||||||
24. HQL Query Analyser coderanch.com | ||||||||||||||||||||||||||||||||
25. what'a wrong woth my HQL query????? coderanch.comHI! I am trying to get records from a table using following HQL query Query q1 = HibernateUtil.currentSession().createQuery( "from InventoryIssuance ii where ii.merchantRegistration=:mr and ii.takenBack like :tb"); q1.setParameter("mr", merchantRegistration); q1.setParameter("tb", "N"); inventoryIssuanceList = q1.list(); but i get inventoryIssuanceList as null according to data in table the conditions must meet, while debugning i found merchnatRegistration as hibernate object (present in db),takenBack has ... | ||||||||||||||||||||||||||||||||
26. HQL many to many query coderanch.com | ||||||||||||||||||||||||||||||||
27. Need HQL query coderanch.comOriginally posted by ravi pamuru: Hi, Im using year to fetch the rcords in the oracle10g but how to convert the date to year i don't know. If anyone knows please let me know. Following is the query that i want to convert holidays.date to year. executeQuery("from EIPublicHolidayBean holidays where holidays.date=:searchYear","searchYear",year); ThanksandRegards, Ravi | ||||||||||||||||||||||||||||||||
28. HQL Query coderanch.comI have 2 classes Person and Address in a one-many relatioship One person can have many addresses I want to write the hql equivalent for this sql query select * from Person p ,Address a where p.id=a.id and a.add_id='103' // this is the query that is working for me now from Person p inner join p.addresses where p.id='1' But now I ... | ||||||||||||||||||||||||||||||||
29. Getting started with HQL - how to query on sets? coderanch.comI am moving from Criteria to HQL and enjoying the process, but have a a question. I have a class "Person" with a one-to-many set of objects "Metadata". Metadata are simple objects; they only have a String key and a String value. I would like to use HQL to query for person objects based on multiple metadata constraints. For example, I ... | ||||||||||||||||||||||||||||||||
30. EL in a HQL query coderanch.comHi guys, I saw something while reading an article that showed a hql query using EL for on of the parameters, and they said that was better than doing something like user.username. When I first saw this I was confused, because I didn't know how you would make a query on a page, and use EL. So I altered my query ... | ||||||||||||||||||||||||||||||||
31. HQL difference in these two queries. coderanch.com | ||||||||||||||||||||||||||||||||
32. Best practices for Hibernate and HQL queries coderanch.comLast day i was working and I wrote an HQL query like select new | ||||||||||||||||||||||||||||||||
33. any good hql query for this scenario? coderanch.comHi All Another query to ask here. we have a table File(name ,date, file_size). anyone has simple query to list name of file where the related size is not 0 let me give some sample data. name date size a 1/1/2001 0 a 2/1/2002 2 a 3/3/2003 0 b 1/1/2000 3 b 2/2/2001 4 If I run the query, it should ... | ||||||||||||||||||||||||||||||||
34. HQL query for year coderanch.comI am trying to understand how to format the HQL query for a specific year. My Savedate is a GregorianCalendar date, I want to query for saved dates in 2009. public class DateDemoMain { public static void main(String[] args){ javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { new DateDemoMain().testrun(); } }); } private void testrun() { Savedate sd = new Savedate(new GregorianCalendar(1967,06,11)); ... | ||||||||||||||||||||||||||||||||
35. HQL query hibernate coderanch.com | ||||||||||||||||||||||||||||||||
36. abbreviate hql-query coderanch.com | ||||||||||||||||||||||||||||||||
37. JPA Query and HQL coderanch.comHello All, I am quiet new to Hibernate and JPA. I started hibernate before but left it because of other demands. I am currently using JPA and Hibernate as a persistance provider integrated with Spring. I have a question, that when we write query statements, can we directly write HQL in JPA. Will that work or we have to write queries ... | ||||||||||||||||||||||||||||||||
38. A query with HQL coderanch.com | ||||||||||||||||||||||||||||||||
39. utterly stumped - HQL query stalls program coderanch.comGreetings all, I've used Eclipse to create a Spring/Hibernate standalone desktop GUI app whose behavior has got me buffaloed - it stalls with no error messages when it hits an HQL query statement in a DAO method. UserDAOHibernate.java package com.ecs.trial_spring.dao.hibernate; import org.hibernate.*; import org.springframework.transaction.annotation.Transactional; import com.ecs.trial_spring.dao.UserDAO; import com.ecs.trial_spring.model.User; import static org.hibernate.criterion.Expression.*; import java.util.*; import utils.Utils; import java.net.*; import java.sql.*; @Transactional public ... | ||||||||||||||||||||||||||||||||
40. HQL and hits query forum.hibernate.orgHi, i'm developing application that use a complex query to Oracle DB and in my hbm i use | ||||||||||||||||||||||||||||||||
41. HQL Query forum.hibernate.orgI am getting this error: Quote: Unable to resolve path [DBO_Contacts.xid], unexpected token [DBO_Contacts] ... my HBM lookes like: Code: | ||||||||||||||||||||||||||||||||
42. n00b quiestion about a HQL query forum.hibernate.orgHi! I need help with a query i want to make that i just cant figure out. I have an Object Billitem with the columns - billitemid, billid, itemid, taxid and Billitemoption with columns - billitemoptionid, billitemid, optionid billid refers to the object Bill, itemid to the Object Item, taxid to Tax, billitemid to Billitem and option id to Option. A ... | ||||||||||||||||||||||||||||||||
43. HQL Query - invalid query forum.hibernate.orgI'm developing an app using Hibernate 3.5.3 and SmartGWT 2.2 (the SmartGWT doesn't really come into it here, but just for completeness) on NetBeans 6.9. For the purposes of this exercise, I created a very simple MySQL database, with just one table, named 'users'. That table has just two columns, 'username' and 'password'. The problem is that when I try to ... | ||||||||||||||||||||||||||||||||
44. HQL Query - Reporting Queries forum.hibernate.orgI am facing a problem with using HQL and aggregate functions to generate report output in HQL. As shown in the SQL below, I am using a nested select in the FROM clause mainly due to the fact that I needed to use the CASE keyword to break the amount field into the necessary reporting buckets. From that query, the outside ... | ||||||||||||||||||||||||||||||||
45. [Urgent]HQL Query gets hanged forum.hibernate.orgI have a select query which is below private String buildQuery (){ String queryFileinfo = "select S.id , S.fileType" + " from FileInfoBean S where "; queryFileinfo = queryFileinfo + " S.fileName = '" + fileName + "'"; eturn queryFileinfo; } when I try running this query as String QueryfileInfo = buildQuery(); Query hql = session.createQuery(QueryfileInfo); Iterator i = null; try ... | ||||||||||||||||||||||||||||||||
46. Hibernate get and simple HQL create different queries forum.hibernate.orgI have a fairly complex object with a number of relationships. If I try to 'get' the object based upon it's id the query generated is massively slow - joining a large number of tables together in a single query (MySQL database). However - if I do a simple HQL - ...from package.class as cls where cls.id = ? - then ... | ||||||||||||||||||||||||||||||||
47. utterly stumped - HQL query stalls program - worth USD50.00 forum.hibernate.orgPage 1 of 1 [ 1 post ] Previous topic | Next topic Author Message kerchunk Post subject: utterly stumped - HQL query stalls program - worth USD50.00 Posted: Thu Sep 29, 2011 11:43 pm Newbie Joined: Tue Aug 03, 2010 4:32 pm Posts: 19 Greetings all, I've used Eclipse to ... | ||||||||||||||||||||||||||||||||
48. Duplicating a seemingly simple query in HQL forum.hibernate.orgRegular Joined: Fri Sep 12, 2003 12:40 pm Posts: 65 I'm trying to retrieve a set of Parents and their children using HQL. In SQL, I would execute the following: Code: select * from selected_attribute_value a, attribute b where a.attribute_id = b.attribute_id and b.item_report_id = '402882c5f7d7367100f7d736b3900001' Where attribute is the parent and selected_attribute_value is the child. I'd like to return a ... | ||||||||||||||||||||||||||||||||
49. Broken HQL query forum.hibernate.org | ||||||||||||||||||||||||||||||||
50. HQL Query forum.hibernate.org | ||||||||||||||||||||||||||||||||
51. Query working from command line,unable to execute from HQL forum.hibernate.orgI am using mysql, my query includes some of date functions. Query working fine from commnadline.. but when i tried to execute from HQL it is throwing QUERYEXCEPTION. my query is : SELECT to_days(now()) - to_days(DATE_ADD(u.last_passwd_change, INTERVAL (ga.password_expiry_period - ga.password_pre_expiry_notify) DAY)) as expiryDate from user as u, global_attributes as ga; Exception details: [STDERR] javax.ejb.FinderException: net.sf.hibernate.QueryException: aggregate function expected before ( in ... | ||||||||||||||||||||||||||||||||
52. HQL required for this query forum.hibernate.orgHi, I am new to hibernate. Can any one please give m e the HQL equivalent for this query. This is DB2 AS400 query.(um_forum and um_topic are the table names) select a.muuid,a.forum_name,count(b.muuid) topics,sum(b.topic_noposts) posts,a.createddate from um_forum a left outer join um_topic b on b.forum_id = a.muuid group by a.muuid,a.forum_name,a.createddate order by a.forum_name,a.createddate desc Thanks and Regards, Umar | ||||||||||||||||||||||||||||||||
53. hql query forum.hibernate.orgI have a HQL query which is of the form select class1 as c1 , class2 as c2 where | ||||||||||||||||||||||||||||||||
54. HQL can parse OQL queries? forum.hibernate.orgHi, HQL can parse the following Castor OQLs without modification? /* all objects */ SELECT obj FROM myproject.Person obj /* only one field */ SELECT obj.name FROM myproject.Person obj /* WHERE over a collection and binding */ SELECT obj FROM myproject.Person ojb WHERE myAddress.street LIKE $1 Exists a extension that converts OQLs to HQLs? are plans about it? This facilitates migration ... | ||||||||||||||||||||||||||||||||
55. TOP-N Query possible with HQL? forum.hibernate.orgChristian, I don't need a smart ass remark. All I'm asking is whether you claim that setMaxResults(500) is in fact supported in version 2.1.4. If you say yes, then I won't bother you. We'll figure out why it's not working for us. But my guy says that the current hibernate code he looked at couldn't possibly support the syntax. And now ... | ||||||||||||||||||||||||||||||||
56. HQL query forum.hibernate.org[b]Hibernate version:[/b] [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close():[/b] Can somebody please tell me how to write the following query in HQL: UPDATE WSZ_TERM t SET (DOCUMENT_COUNT, DOCUMENT_COUNT_ACTUAL, TERM_FREQ_OVERALL)= ( SELECT LN(t.document_count_actual + count(DOCUMENT_ID)), t.document_count_actual + count(DOCUMENT_ID), t.term_freq_overall + SUM(FREQ_PER_DOC_ACTUAL) FROM WSZ_TERM_FREQUENCY_PER_DOC WHERE BATCH_ID = ? AND TERM_NAME=t.TERM_NAME group by TERM_NAME ) WHERE TERM_NAME IN ( SELECT distinct(TERM_NAME) FROM WSZ_TERM_FREQUENCY_PER_DOC WHERE ... | ||||||||||||||||||||||||||||||||
57. Cannot create HQL for a confusing query.. forum.hibernate.org... | ||||||||||||||||||||||||||||||||
58. HQL Query..... forum.hibernate.orgI'm having a bit of a problem coming up with an HQL query, and wondered if someone could help me.... In my domain model, I have a Topic, User and Subscription. A Topic has a set of Subscriptions against it, and each Subscription belongs to a User. A User can have many simultaneous Subscriptions and additionally has the concept of a ... | ||||||||||||||||||||||||||||||||
59. Unexpected implication of UserTypes in an HQL query forum.hibernate.orgList result = session.createQuery("select example from Example as example where example.flag=?") .setParameter(0, BooleanInteger.TRUE, Hibernate.custom(BooleanIntegerUserType.class)) .list(); | ||||||||||||||||||||||||||||||||
60. HQL Query? forum.hibernate.orgpublic List getRightsForLicence(Licence licence, List rightsTypes) { Object[] objects = new Object[2]; for(int i = 0; i | ||||||||||||||||||||||||||||||||
61. Combining HQL queries forum.hibernate.org | ||||||||||||||||||||||||||||||||
62. How to write HQL query for one-many-one forum.hibernate.orgHi, I found out how to make a query but now I have a problem with composite keys This is my query: from A a, B b where b = all elements ( a.hasB.bList ) and b.hasC.C.Name='Hello' Now I have a problem if B has a composite primary key. I am getting an exception path expression ends in a composite value ... | ||||||||||||||||||||||||||||||||
63. HQL that queries timestamps forum.hibernate.orgA quick question. I have a database table that stores a date of birth as a timestamp (yes, I know). If I want to do a query against that table, based on timestamp (e.g. find me records where the data of birth is 10/12/1978), then I get this: Exception data: java.lang.UnsupportedOperationException: cannot perform lookups on timestamps Now I've read other posts ... | ||||||||||||||||||||||||||||||||
64. Unable to determine HQL for query forum.hibernate.orgI'm trying to construct the HQL equivalent for the following SQL and I'm at a loss (and extremly frustrated - this *should* be simple). I've tried a number of things but I have not had any luck. Any help is greatly appreciated. My SQL: I have an id for a record in the A table. I want a list of records ... | ||||||||||||||||||||||||||||||||
65. HQL - Query works in "HQL Editor View", but not in forum.hibernate.orgHi, I've got a query: select spfli.sflights.planetype from de.model.sap.Spfli as spfli This query works in the "HQL Editor View" from the tools. But using this query in my application throws an error, that the property sflights could not be resolved. What am I missing here? (Mapping-file and exception below) Thanks Jonny Hibernate version:3.0.2 Mapping documents: Spfli.hbm.xml: ... | ||||||||||||||||||||||||||||||||
66. IllegalStateException trying to execute a simple HQL Query forum.hibernate.orgBeginner Joined: Fri Feb 20, 2004 6:15 pm Posts: 38 I'm doing a simple query from Expense table and I get the error below. Other queries work fine, so I'm not sure why Hibernate is having a problem here. Note that this only happens when I specify a "select description" in front of the from clause. If I just do a ... | ||||||||||||||||||||||||||||||||
67. hql query forum.hibernate.orgMap your REP_LOG table to a class called REP_LOG. Make sure the class has properties called RL_ID and USER_ID and map them to this columns. This way your HQL looks exactly like the SQL. The big difference is, that the SQL (called via JDBC) gets you a resultset, everything else you have to do yourself (read it, take some actions, create ... | ||||||||||||||||||||||||||||||||
68. How to optimize HQL queries forum.hibernate.orghi there! I've been searching for ways to optmize my HQL queries. I was able to reduce the number of selects with the "left join fetch", but not like in the examples I found. They [the examples] shows the query in the form "select is there a shorter hql query available for this function? I thought of something like "from Book where authors.name like ?" instead of "from Author where name like ?" where i need to loop through the authors. Function: Code: public List getBooksByAuthor(String author) throws DataAccessException { List authorList= getHibernateTemplate().find("from Authors where name like ?", author); ... Hi, All I have a class User which has a set of Role, User and Role are hibernate mapped POJO. User and Role are many-to-many mapped. Now I want to query all users which has multiple specified roles (The number of roles to match is dynamicly specified by user through the page). I don't know how to construct the HQL for ... Hello, I'm confused by what hibernate (v3) is doing to one of my HQL queries when it processes it. The query is: Code: select tm.townMeetingId, tm.meetingTime, tm.location1, tm.location2, tm.address1, tm.address2, tm.city, tm.state, tm.zip, tm.county, (select ... Whats wrong with this code? Code: createQuery( "UPDATE CustomerActionModel as customerAction " + ... Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.0 Mapping documents: Somebody can tell me what should i do to avoid this error? Thanks Phil Caused by: org.hibernate.hql.ast.QuerySyntaxError: unexpected token: ( near line 1, column 1 [(select C.idcity as ALIAS,C.city,count(P.idprofile) from com.project.model.bean.City as C, com.project.model.bean.Member as M, com.project.model.bean.Profile as P where P.topic_idtopic=1 and M.idmember=P.member_idmember and M.default_idcity=C.idcity group by idcity) UNION (select C.idcity,C.city,count(E.idevent) from com.project.model.bean.City as C, com.project.model.bean.Event as E where E.topic_idtopic=1 and ... Hi all, I have a group object. This object has a set of images. I use this query to load all the images in a group where the images in that group has a certain width: from group where uuid=? and images.width=? This works fine just as long as there are images in the group. If the group has no images, ... String hqlUpdate = "update CaseStage caseStage set caseStage.stageEnd=:stageEndValue where caseStage.stageType.finalStage=:finalStage"; Query query = createQuery(hqlUpdate); query.setDate("stageEndValue", assignedDate); query.setLong("caseId", caseKey); query.setBoolean("finalStage", true); return ... Hi, I am new to Hibernate. I want all users'names not starting with "Mu%". This is my code. Query q = session.createQuery("from Test u where u.name like \"Mu%\" "); List result = q.list(); The above query is retrieving all rows from the table. Please let me know whats wrong in the above query and also let me know correct one. - ... Hi, I have encountered a problem when migrating from Hibernate 3.1.3 to 3.2.0-ga. A HQL query which has worked very well before the update seems, now, to have a syntax error, because I have obtained the following exception : java.lang.IllegalStateException: DOT node with no left-hand-side! at org.hibernate.hql.ast.tree.DotNode.getLhs(DotNode.java:559) at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:534) at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.extractDataType(BinaryLogicOperatorNode.java:168) at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.initialize(BinaryLogicOperatorNode.java:35) at org.hibernate.hql.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.java:1014) at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3992) ... This is the ... I'm currently using 3.1, and having some issues with pulling a random single record from my database. The mysql query utilizes the following format: "select * from table order by rand() limit 1" This query results in one random record from the DB. With HQL, it throws an error on "limit" in the form of: unexpected token. I've searched and found ... hi all, i am working with dynamic model (dynamic map) in place of persistent classes. now i want to execute an HQL query which is a normal select. since there is no persistent class, i get the following error: Caused by: org.hibernate.hql.ast.QuerySyntaxException: teams is not mapped [from teams] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:267) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3049) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938) at ... Hi, I have a partitioned table ORDERS having two partitions named: OpenOrders and ClosedOrders. Now I want to fire a delete on some of the closed orders. So to make the query efficient i want to specify the partition from which to delete (which will be ClosedOrders partition). But when I use normal SQL syntax : delete from Orders partition (closedOrders) ... Hi I have an hibernate HQL query as follows (This is just an example) "select new DataTransferObject(app.listOfItems) from ModelObject as app " The item passed into the constructor is a list mapped as a many-to-many List in the HBM file. When I run the query passing in the List to the contructor I get an exception. If i dont pass this ... I need help to migrate a trivial HQL to criteria :) Let's say there is a many-to-many relationship between Company and Address. I need to select all Companies that have subsidaries in selected cities. E.g select all companies that are located in New York and Boston: HQL: from Company c where c.addresses.city = 'New York' and c.addresses.city = 'Boston' "addresses" is ... I have to make an Hql which execute different queries depending on a parameter. Something like: If (parameter=0) then from table1 else from table2 end The problem is that as silly as it seems I really have to do all of this in a single query, I cannot actually make the test in java and then call the query I want. ... Could somone help me translate this SQL into HQL.Your help is highly appreciated [code] SELECT name, MAX(isinuse) AS isinuse FROM ( SELECT c.DISPLAY_TEXT AS name, MAX(DECODE(r.FK_COMPANY, s.FK_COMPANY, 1, 0)) isinuse FROM SOURCEREQUIREMENT sr, SUBSCRIPTION s, COMPANY c, ROLE r WHERE s.FK_SRCREQ = sr.PK_SRCREQ AND s.FK_COMPANY = c.PK_COMPANY AND sr.PK_SRCREQ = r.FK_SRCREQ GROUP BY c.DISPLAY_TEXT UNION SELECT c.DISPLAY_TEXT AS name, MAX(DECODE(p.FK_COMPANY, s.FK_COMPANY, ... You don't need to use a subquery. if you need the 20th child you should make a query like this: "FROM table_name ORDER BY AGE DESC" So set the query.setFirstResult(19); // 19 because it start counting by 0 and set the query.setMaxResults(1); // Return just 1 result; This is a simple query and will retrieve only one result: the 20th child ... While executing HQL query ,will Hibernate use second level cache? For example Table : coded_sample Sno identifier code meaning remarks 1 1001 CC1 coded sample1 sample code 2 1002 CC2 coded sample2 sample code 2 1003 CC3 coded sample2 sample code entity name is : CodedSample Second level cache introduced for CodedSample entity. First and second records are loaded into memory ... Sometimes, it's necessary to decrease the isolation level of certain queries to that of "uncommited read". It's common in highly concurrent enterprise systems like ERP, CRM, and other OLTP systems. In these cases, the decision took in account the balance between transaction isolation protection and system's overall performance. I was wondering why Hibernate hasn't provided an option to change isolation level ... |