hql 1 « Query « JPA Q&A





1. How do I write a HQL Query for this?    stackoverflow.com

I 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.

public class Group
{
   ...

2. HQL query equivalence: Why are them different    stackoverflow.com

Hi I have a working HQL query which I want to optimize. It is as follows:

select distinct A.id from Import as A, Place D 
where (A.place=D or A.placeBOK=D) and D.country=? 

I tried ...

3. Proper way of writing a HQL in ( ... ) query    stackoverflow.com

Assuming that I want to write the following HQL query:

FROM Cat c WHERE c.id IN (1,2,3)
what is the proper way of writing this as a parametrized query, e.g.
FROM Cat c WHERE ...

4. HQL and one-to-many queries    stackoverflow.com

I have Hibernate domain objects that looks like this:

   class Player {
      List<Item> inventory;
   }

   class Item {
   ...

5. How do you do a limit query in HQL    stackoverflow.com

In Hibernate 3, is there a way to do the equivalent of the following MySql limit in HQL.

select * from a_table order by a_table_column desc limit 0, 20;
I don't want to ...

6. HQL query, how to?    stackoverflow.com

I am working query with little idea of what software I am dealing with and minimum knowledge HQL. What I am looking is,

SELECT Entity1 FROM Entity AS Entity1
WHERE (EXISTS ELEMENTS(Entity1.config.dateTimeInfo.ntpConfig.server) )
But ...

7. Hibernate HQL query - complicated    stackoverflow.com

I 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.com

I 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.com

did i encounter a hibernate bug or do i have an error i dont see:

select enty.number from EntityAliasName enty
  where enty.myId in
  (
    select cons.myId from ...





10. hql query formation    stackoverflow.com

I want to construt a hql query like

select PLAN_ID from "GPIL_DB"."ROUTE_PLAN" where ASSIGNED_TO 
      in ('prav','sheet') and END_DATE > todays date
I am doing in this way ...

11. Java Hibernate HQL queries with nolock    stackoverflow.com

Is 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.com

I have a query but I dont know how to make it optimal. I have three objects.

  • SCP
  • Question : it has a field that points SCP (SCP_id)
  • Answer : it has a ...

13. Using cfqueryparam with a ColdFusion HQL query    stackoverflow.com

I am using a HQL query to get a bunch of state objects like so:

<cfquery name="LOCAL.qStates" dbtype="hql">
    from States where countryID = #ARGUMENTS.countryID#
    order by ...

14. HQL JoinTable not accessible    stackoverflow.com

i have a many to many relationship between media and tags: Medium:

@ManyToMany(fetch=FetchType.EAGER)
@IndexColumn(name="tags_index_column")
@JoinTable(name="tag_map",
          joinColumns={@JoinColumn(name="tag_id")},
          inverseJoinColumns={@JoinColumn(name="item_id")})
private ...

15. Query for existance in HQL efficiently    stackoverflow.com

I have a class Employee with three class members: id, isVisible, sectionId. I want to query in HQL:

  1. If a certain section has any Employees at all
  2. If so - are all the employees ...

16. HQL Query Based on Set Contents    stackoverflow.com

I have a hibernate managed POJO with a set:

public class Book {
    private Set<Page> pages;
    public Set<Page> getPages() { return pages; }
    ...





17. Sum Of Two Queries HQL    stackoverflow.com

I 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.com

I 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.com

I've the following query:

select u from User u where upper(u.name) like upper(?1)
How this would be, but ignoring the accents in u.name and ?1? Thanks guys!

20. Parsing an HQL query    stackoverflow.com

Given an Hql query, I'd like to parse it to get a list of the entities that are being queried: e.g. select from Table1, Table 2 where .. I'd like to get ...

21. Hibernate creates more than one query from hql query    stackoverflow.com

I 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.

@NamedQuery(name=PointOfInterestLabel.FIND_BY_FIGURE, query="Select pl FROM PointOfInterestLabel ...

22. HQL Query window - invalid query?    forums.netbeans.org

Budfudder 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.org

hi 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.com

HI! 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.com

Originally 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.com

I 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.com

I 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.com

Hi 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.com

Last day i was working and I wrote an HQL query like select new. (param1, param2, param3....) FROM WHERE .. . The POJO I used in the above query was a mapped entity... and when my lead saw this he told me not to do this and to make a new class for that purpose. I was not explained any reason.. ...

33. any good hql query for this scenario?    coderanch.com

Hi 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.com

I 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.com

Hello 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.com

Greetings 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.org

Hi, i'm developing application that use a complex query to Oracle DB and in my hbm i use . I use HQL with hint but i observed that using query hint, the performance degrades. Can you help me, about this problem? Query hint is supported by Hibernate? The degrades depends using query hints? Any suggestion will be appreciate. Dan

41. HQL Query    forum.hibernate.org

I 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.org

Hi! 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.org

I'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.org

I 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.org

I 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.org

I 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.org

Page 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.org

Regular 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.org

I 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.org

Hi, 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.org

I have a HQL query which is of the form select class1 as c1 , class2 as c2 where The query returns with a list of objects of type 'Object'. I want to know how do i extract class1 and class2 from the returned value.Casting to either class1 / class2 fails tia splash

54. HQL can parse OQL queries?    forum.hibernate.org

Hi, 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.org

Christian, 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.org

I'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.org

List 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.org

public 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.org

Hi, 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.org

A 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.org

I'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.org

Hi, 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.org

Beginner 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.org

Map 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.org

hi 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 from

where left join fetch ", but always I did like this I got ...

69. Shorter HQL Query avalable    forum.hibernate.org

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); ...

70. How to query with HQL from Many-to-Many?    forum.hibernate.org

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 ...

71. HQL query parser in H3    forum.hibernate.org

72. HQL Query    forum.hibernate.org

73. HQL query not being parsed correctly    forum.hibernate.org

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 ...

74. newbie: simple hql query...    forum.hibernate.org

75. HQL and queries    forum.hibernate.org

...

76. Wrong HQL query?    forum.hibernate.org

Whats wrong with this code? Code: createQuery( "UPDATE CustomerActionModel as customerAction " + ...

77. Unicode in HQL query    forum.hibernate.org

78. Newbie - HQL query    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.0 Mapping documents:

79. substr in the HQL query    forum.hibernate.org

80. Static Methods in HQL-Queries    forum.hibernate.org

81. HQL query trouble with UNION    forum.hibernate.org

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 ...

82. HQL query failing on empty set    forum.hibernate.org

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, ...

83. HQL query depth    forum.hibernate.org

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 ...

84. Reg. HQL query    forum.hibernate.org

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. - ...

85. Pb with HQL query migrating from 3.1.3 to 3.2.0    forum.hibernate.org

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 ...

86. HQL Query with rand() and limit    forum.hibernate.org

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 ...

87. hql query    forum.hibernate.org

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 ...

88. How to specify partition in HQL query ?    forum.hibernate.org

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) ...

89. HQL "contains" query?    forum.hibernate.org

90. HQL query by day-of-week?    forum.hibernate.org

91. HQL many to many query    forum.hibernate.org

92. Using a DTO in HQL query    forum.hibernate.org

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 ...

93. Many-to-Many query - simple with HQL impossible with Criteri    forum.hibernate.org

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 ...

94. HQL multiple queries    forum.hibernate.org

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. ...

95. Does Hibernate Support union hql query    forum.hibernate.org

96. HQL Query    forum.hibernate.org

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, ...

97. hql query 2    forum.hibernate.org

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 ...

98. While executing HQL query ,will Hibernate use second leve    forum.hibernate.org

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 ...

99. Executing Hibernate 3 HQL queries    forum.hibernate.org

100. Why not allow uncommited read in individual HQL queries?    forum.hibernate.org

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 ...