1. Hibernate "IN" clause as ALL instead of ANY stackoverflow.comI'd like to start by apologizing for my unfamiliarity with Hibernate. I'm only recently getting into it and am far from an expert. I have three tables: Contract, Products, and ... |
2. Handle SQL injection in HQL order by clause stackoverflow.comis there a simple way to handle SQL injection in Hibernate HQL order by clause. Named params obviously doesn't work for it. EDIT: Feel free to post your way of handling this problem. ... |
3. Hibernate createNativeQuery using IN clause stackoverflow.comUsing Java, Hibernate. I have a query
I'm not able to bind this parameter to ... |
4. ON clause with Hibernate Query interface stackoverflow.comI am getting HibernateQueryException,when i use On clause with Left Outer join. Can anyone suggest me what is the cause. Regards, Raj |
5. hibernate inner select in from clause stackoverflow.comI'd like to know if it's possible to specify a select clause in a from clause something like
|
6. Not in clause in Hibernate stackoverflow.comHow do I achieve something like -->
|
7. Hibernate Criteria Query is adding an extra order by clause stackoverflow.comI have a DetachedCriteria query with projection and transformer as given below
I then get Citeria from session and ... |
8. How to use IN Clause in HQL coderanch.comHi All, I am new to hibernate. My project already has hibernate implementation. I have introduce a new query which should use a IN clause. For E.g., SELECT * FROM FEATURE WHERE FEATURE_NAME IN ('TAX','GEO_CODE'); I will be getting the values in the IN clause in a collection in my code. How should i pass the value to the HQL query? ... |
9. How to use IN clause in HQL? coderanch.comHi, I am looking to use IN clause in my HQL. I referred some forums and couldnt get an optimal idea for this. One approach i tried is to set the parameter of HQL as shown below: My HQL: SELECT prd FROM ProductORM AS prd WHERE prd.productID in (:selPrdIDs) Java code: hqlQuery.setParameterList("selPrdIDs", prdIdList); //prdIdList is List |
10. How to use Union clause in Hibernate coderanch.com |
11. THe Hibernate "In" clause coderanch.comHi All, I have a requirement which needs to put in the in clause in hibernate. The problem is I am unable to do that.As the data on which I have to apply the in clause is also a subquery and not a list of static elements. Eg:" from Abc abc where abc.id in (....sub qurery....) ----> Is this possible..I tried ... |
12. Problem IN clause in HQL query coderanch.comHi to all, i'm working with Hibernate JPA right now and i have a problem. Basically, i have a named query in my entity, this named query is the next: @NamedQuery(name = "WbkOpcionesMenu.findOpcionesPadre", query = "SELECT w FROM WbkOpcionesMenu w WHERE " + " :codusr in (w.wbkUsuariosList) ") The problem is about the IN clause, where i want to find a ... |
13. Criteria with and/or clause from a variable forum.hibernate.org |
14. Queries AS clause changing for different runs forum.hibernate.orgHi, The queries getting generated differ only in the AS clause. Two examples are given below. First Time: ---------- select addr.street_address as street_address_01, .... from address addr where ...... Second Time: ------------- select addr.street_address as street_address_02, .... from address addr where ...... In the above queries if you notice for the second run the query changed only by the AS clause ... |
15. Problem to execute Select query with AS clause inside on Mac forum.hibernate.orgHi all, I am working with Mysql 5.1.45 for Mac. In my application i must execute some SELECT query (SQLQuery) with some AS clause inside them. When I try to execute the query calling the method : Iterator resultObj = query.list().iterator(); I got an exception from Hibernate : query can not be executed All the Select query which contain AS clause ... |
16. Workaround for Subselects in From Clause forum.hibernate.orgHello to all of you. I am quite new to hibernate, but i am really exited about the functionallity, and the easy usage. However i am creating an application where i have to perform a subselect in a from clause. After searching the hibernate reference i found out, that hibernate does not support subselects in from clause. Quote: Note that HQL ... |
17. IN clause limitations forum.hibernate.org |
18. HQL Order by clause forum.hibernate.org |
19. HQL - how to use select query in the 'from' clause? forum.hibernate.orgI want to use a select query as a table instead of actual table name. The documentation does not talk about using select queries in the "from" clause. Please advise. Here is my example. This is actual sql query. SELECT pr.prod_no, sum_of_amt, prod_desc, prod_nam, prod_max_ord_qty FROM ( SELECT pr.prod_no, SUM(ol.ord_ln_shp_amt) sum_of_amt FROM ord_ln ol, ORD_LN_STS os, PROD pr WHERE pr.prod_no = ... |
20. hql IN clause forum.hibernate.orgHi Chapter 9.8. Expressions says that there is a IN clause but how can we use it. I have something like this and I'd like to use the in clause for a NUMBER field. String queryString = "select acc from cgix.trust.domain.PtbnAccount as acc where acc.accountId IN =: accountdId"; Query query = session.createQuery (queryString); query.setParameter("accountId", accountFilter); ??????? Thanks in advance |
21. In clause forum.hibernate.orgHi, I am using hibernate for quite a sometime now. I been working on this query for past couple of days I am using 2 "IN" clause in the where condition of query. I have oracle as backend server. I think that this isn't allowed or what? My query is Query query=session.createQuery("from BasicPolicyDetails basic where basic.product.id in (:productid) and basic.agentType.id=:agentTypeid and ... |
22. many to one, in clause forum.hibernate.orgI have a many to one relationship between a table with demographic data and one with geographic areas. So there is a population figure, a housing figure, a per capita income figure for any one geographic area. In my application I get a set of data figures requested for a set of geographic indicators. So I should get back the number ... |
23. Problem with "select new" HQL clause forum.hibernate.orgFolks, When my DTO object that I am "Select new"'ing into has a constructor that takes native types, I get the error attached. If my DTO has a ctor which takes wrapper types, the code works. If it has both, then Hibernate seems to prefer the native version, and I get the error. I tried implementing the native-type ctor in two ... |
24. PROBLEM: HQL query with IN clause forum.hibernate.org |
25. SQL clauses in HQL queries forum.hibernate.orgHibernate version:2.1.2 Database: Ingres 2.6 SP2 When you write a HQL query, it is actually possible to drop back to SQL in the ORDER BY clause, like this: Code: SELECT object.createDate FROM Object AS object ORDER BY d_created Notice the SQL column name in the ORDER BY clause, but a correct property reference in the SELECT clause. Unfortunately, the query that ... |
26. Uncommitted read in select clause forum.hibernate.org |
27. Hibernate and UNION clause forum.hibernate.orgHow does hibernate handle UNION in a SQL. I have to run a query that selects a different set of columns from the same table based on a parameter. I have to use the union clause, but I can't find any lead on how would Hibernate's Query object address this issue. For a table say, Employee with columns, Id, FName, LName, ... |
28. IN clause forum.hibernate.org |
29. select clause in criteria query forum.hibernate.orgIs there any way I can use select clause in criteria query? I would like to use the following query select new MessageRecipient(r.Id) from MessageRecipient r join r.Message m where m.sender = 'userId1' and subject like 'test%' I don't want to load MessageRecipient with all of it's data because it's has more relation ships which cuases more SQL queries to be ... |
30. Adding security related clauses to sql query forum.hibernate.org |
31. Getting vendor specific clause in select into HQL forum.hibernate.org |
32. How to use CONNECT BY clause in a HQL forum.hibernate.orgHi, I think y question was not very clear. the question has 2 parts: 1. Does HQL supports CONNET BY clause 2. If yes then how to use that. I will add a third question: 3. If have to use the native sql then how would I use it for the query stated. I looked up at the hibernate documentation and ... |
33. SELECT clause in FROM clause in Hibernate forum.hibernate.orgDoes hibernate query support select clause in from clause? any help will be greatly appreciated[/quote] I've a similar problem and I workarounded this way: String sqlQuery = "SELECT COUNT(*) FROM ( " + myClass.translateHQL2SQL( innerQuery ) + " )"; And then executed as a SQL query. and to translate HQL to SQL you can you something like: ASTQueryTranslatorFactory cqt = new ... |
34. OR clauses in HQL forum.hibernate.org |
35. I'm officially pissed... From Clause (ANSI) forum.hibernate.orgI've been trying to understand this ANSI FROM CLAUSE for two days now, and I can't figure it out.... The Hibernate reference PDF only has a one pager on it !!!! Where can I find more information on this? I search ISO website, this forum, Sybase's website... I can't find any books. How are we suppose to learn how to use ... |
36. problems with having clause forum.hibernate.orgI don't know why hibernate doesn't like my having clause, see details below. I saw a mention that some databases don't support having and mysql was noted, but the following query in mysql works just great: select zipcode, latitude, longitude, acos(sin(0.590156348) * sin(latitude/57.29) + cos(0.590156348) * cos(latitude/57.29) * cos(longitude/57.29 - -1.475641918)) * 3963 as distance from address having distance < 20 ... |
37. HQL: Problem with "with" clause on many-to-many forum.hibernate.org |
38. problem with HQL query and order by clause forum.hibernate.orgHibernate version:3.1.2 Database on the backend: DB2/AS400 Dialect used: org.hibernate.dialect.DB2400Dialect I have a simple HQL query: "select e.empId, e.empName from Employee as e order by e.empName" The generated SQL will be: "select employee0_.EMP_ID as col_0_0_, employee0_.EMP_NAME as col_1_0_ from EMPLOYEE employee0_ order by e.empName" Then an exception will thrown: cannot identify e.empName This is because hibernate engine lables empName as col_1_0_ ... |
39. "Escape" clause and quotations in HQL? forum.hibernate.orgHi everyone, What is the equivalent clause to 'escape' from SQL in HQL? ex.: select * from client as cli where cli.name like ('%/%%') escape ('/') How can I make my query in HQL to find for a field with a ' ? example with SQL: select * from client cli where cli.name like ('%''%') in SQL, I must write 2 ... |
40. Query in HQL from Clause forum.hibernate.orgI have a HQL query in the from clause and it keeps on complaining. Please see below for error and actual query: net.sf.hibernate.QueryException: in expected: select [select distinct incident from ( select distinct rownum r, incident from com.bagnet.nettracer.tracing.db.Incident incident where 1=1 and incident.itemtype.itemType_ID = :itemType_ID order by incident.incident_ID ) where r between 0 and 15] Any help will be highly appreciated. ... |
41. Beteween clause forum.hibernate.orgCalendar calendar = new GregorianCalendar(); calendar.set(2006, 4, 24); Date begin = calendar.getTime(); calendar.set(2006, 5, 18); Date end = calendar.getTime(); String hql = "from User as ... |
42. Using "With UR" Clause in HQL forum.hibernate.org |
43. Calculation in "order by" clause forum.hibernate.orgI'm trying to do a search for the nearest zip code that a sales rep is responsible for to the zip code entered by the user. I've got 3 tables, one with the sales reps, one with zips and then a join table for zips that are owned by reps. The problem I'm having is figuring out how to use the ... |
44. Using SQL In Clause with Hibernate forum.hibernate.orgHi, I need some help in Using SQL In Clause with Hibernate. How do I pass mutiple parameters in SQL IN clause using HQL and Criteria class? Here's the example of the SQL. select id, name, description from some_table where some_column in (?, ?, ?, ?, ?) order by id; Best Regards, Sanjay |
45. any suesion to use ignorecase and SQL in clause ? forum.hibernate.orgI have a requirement where the SQL should look like Select * from EMPTABLE where UpperCase(EMP_NAME) in ('TOM','DICK',HARRY') in this SQL : I am trying to retrieve rows by converting the EMP_NAME column to uppercase ( or for that matter I can convert it to lowercase and put the condition in lower case ), and putting the 'in' clause ( a ... |
46. How to do Criteria with SubCriteria OR Clause? forum.hibernate.orgHi., I have a Parent class (A) with onetoone association to a class (B). HQL : From A WHERE A.B.property1="1" OR A.B.property2="2" Criteria API: Criteria aCrit = session.createCriteria(A.Class); Criteria bCriteria = aCrit.createCriteria("B"); // SubCriteria bCriteria.add(Restrictions.eq("property1","1")); Problem: With above kind of Criteria query, i always get AND clause but I need to have OR clause. Any help would be highly appreciated. Thanks ... |
47. Regarding Froup By Having clause in Criteria Queries forum.hibernate.orgHi All ! I'm Krishna. I'm working with Hibernate Criteria queries. I'm writing Group By query. I dont know how to apply Restrictions for Gruop By clause. Anyone know how to write having clause in Criteria Group By Projections. My code is like this: List statusList1=session.createCriteria(Division.class,"divn") .createCriteria("companyProfiles","company") .add(Restrictions.eq("companyId", companyId)) .createCriteria("divn.divisionCostCenters", "divisionCostCenter") .createCriteria("costCenter","cc") .createCriteria("expenseReports", "report") .createCriteria("expenseReportStatuses", "ers") .add(Restrictions.between("modifiedDate",stDate,edDate)) .setProjection( Projections.distinct(Projections.projectionList() .add(Projections.groupProperty("divn.divisionId")) .add(Projections.groupProperty("report.costCenter.costCenterId")) ... |
48. Using IN Clause in HQL forum.hibernate.orgHi All, I am new to hibernate. My project already has hibernate implementation. I have introduce a new query which should use a IN clause. For E.g., SELECT * FROM FEATURE WHERE FEATURE_NAME IN ('TAX','GEO_CODE'); I will be getting the values in the IN clause in a collection in my code. How should i pass the value to the HQL query? ... |
49. problem to write a query with WITH clause forum.hibernate.orgHi, You cannot start an HQL query with 'WITH'. Here is an extract from HQL grammar, queryRule : selectFrom (whereClause)? (groupByClause)? (orderByClause)? ; selectFrom! : (s:selectClause)? (f:fromClause)? { // If there was no FROM clause and this is a filter query, create a from clause. Otherwise, throw // an exception because non-filter queries must have a FROM clause. if (#f == ... |
50. Order by clause, ignored forum.hibernate.orgHi Thanks for the reply! I tried Code: INFO: Creating query select i2 , i1 from Property as i1 inner join i1.propertyEntity as i2 where i2.type = 'orderby' order by i1.dateTime asc and got the following output from hibernate, it is the same as before. My order clause are removed. Code: as suggested Hibernate: ... |
51. Multiple hql-with-clauses in Hibernate 3.2.4.sp1 forum.hibernate.org |
52. problem with 'having' clause in query forum.hibernate.orgHi, It appears the hibernate libraries don't recognize a valid query with the 'having' clause. I'm using Hibernate 3.2.2.ga and Hibernate annotations 3.2.1.ga. Here is the error I get: Code: 12:20:34,793 ERROR [org.hibernate.util.JDBCExceptionReporter] Not in aggregate function or group by clause: COLUMN MERCHANTSC0_.SCORE_DATE in statement [select merchantsc0_.mid as mid2647_, merchantsc0_.score_date as score2_2647_, merchantsc0_.avg_Avail as avg3_2647_, merchantsc0_.avg_CustS as avg4_2647_, merchantsc0_.avg_Ease as avg5_2647_, ... |
53. Hibernate seems to add spurious order by clause forum.hibernate.org |
54. new to hql/hibernate - howto sql except clause? forum.hibernate.orgDo you want field one to be equal to something or not equal to something ? You have = to operator for field1 in the HQL you posted ... from MyTable t where t.field1 = 'something' and t.bar = 'blah' or t.bar2 = 'blah2' or t.field3 = 'that' I assume it was a typo. Have you tried this : from MyTable ... |
55. HQL in-clause forum.hibernate.org |
56. Having clause in criteria forum.hibernate.orgI have a query like this : Code: /* *select this_.department, * sum(this_.salary) * from Employee this_ ... |
57. Trouble with LIMIT clause forum.hibernate.orgWe have a working hibernate app in Tomcat. It is using hibernate 3, MYSQL 5.0.41. I added a limit clause to a working query and get an exception. Here is my query: FROM UserAuditEventLogs WHERE realmid=:orgName AND userid=:userName AND eventTime>=:startTime AND eventTime<=:endTime ORDER BY eventId LIMIT 1000 I also tried putting the LIMIT clause before the WHERE clause and specifying both ... |
58. Cannot order by named selected clause forum.hibernate.org[b]Hibernate version: 3.2.6.ga[/b] In Hql, if I name a selected object as something, I cannot use that name as an order by clause. For example, the following HQL does not work: select rrCase, (select count(note) from Note note where rrCase = note.rrCase) as count from RrCase rrCase order by count In this case, I am selecting all rrCase's and a count ... |
59. Casesensitivity in order by clause on Unix?! forum.hibernate.orgselect rmt_dropdo0_.dropDownID as dropDownID73_, rmt_dropdo0_.dropDownName as dropDown2_73_, rmt_dropdo0_.item as item73_, rmt_dropdo0_.value as value73_ from RMT_DropDown rmt_dropdo0_ ... |
60. select new clause problem in hql forum.hibernate.orgorg.hibernate.MappingException: Unknown entity: com.bla.bla.wrapper.MyWrapper at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338) at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:50) at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:584) at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:576) at com.deltax.ui.swing.jtable.JValueListTable.paint(JValueListTable.java:252) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JViewport.paint(JViewport.java:728) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JLayeredPane.paint(JLayeredPane.java:559) at javax.swing.JComponent.paintChildren(JComponent.java:842) at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021) at javax.swing.JComponent.paint(JComponent.java:1014) at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963) at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916) at javax.swing.JComponent._paintImmediately(JComponent.java:4859) at ... |
61. Problem with "not (a, b) in (select ...)" clause forum.hibernate.orgselect (...) from Edge edge0_, Node node1_ where edge0_.target=node1_.id and node1_.name = (...) and ((edge0_.target, edge0_.source) not in (select edge2_.source, node1_.id as id8_1_ <-- ??????? ... |
62. Having clause for Criteria forum.hibernate.orgHi all, I'm using Projections.count on a particular property in my criteria query. Further , i want to retrieve only those records where the above count is greater than 50. My SQL is something like this Code: select count(called_number) from call_dets group by called_number having count(called_number) > 50 ; The criteria looks like -- Code: public List getCallDetsForReport(Map objectArgs) ... |
63. HQL: Problem with IN clause forum.hibernate.orgHi all, I have the following relevant ejb3 entity beans (i've excluded a lot of code for simplicity so it will probably look incomplete): User: @Column(name = "username", nullable = false, unique = true) String username; @OneToMany(cascade = CascadeType.ALL, mappedBy = "groupowner", fetch = FetchType.EAGER) Set |
64. Select clause in HQL forum.hibernate.orgHQL for select clause that contains : 1. columns 2. count(columnname) - to hold value of total records selected by the query. 3. sum(columnname) - to hold summation of value for all the records for the specified column name. Can a HQL, serve this purpose ? How does the HQL look like in this case? Thanks, |
65. Order By clause in HQL forum.hibernate.orgHow to parametrize the Order By clause in HQL. For Eg. There is table Customer with columns CustID, CustName, CustAddress.... Map CustomerEntity to Customer Table. SQL : Select * from customer T1 Order by T1.custID desc HQL: Select T1 from CustomerEntity T1 Order by T1.custID desc. I want the order by clause parametrize i.e HQL: Select T1 from CustomerEntity T1 Order ... |
66. Contains clause using Criteria forum.hibernate.orgHi, I am new to hibernate and here is my problem: I want to return companies which has both words "ABC" and "INVESTMENT" in their names. I am using criteria API and trying to play with crt.add(Restrictions.like("name", "ABC")); crt.add(Restrictions.like("name","INVESTMENT"); The problem with above code is, the query is returning below results 1) ABC INVESTMENT CORPORATION 2) ABC INVESTMENTS COMPANY 3) ABCD ... |
67. Critera Query with Assocations determine SELECT Clause forum.hibernate.org |
68. SELECT not supported in IN clause? forum.hibernate.org---begin error--- net.sf.hibernate.QueryException: aggregate function expected before ( in SELECT [ from CMS_TRAVEL_BILLS in class edu.gettysburg.beans.TravelBill WHERE CMS_TRAVEL_BILLS.billId IN (SELECT DISTINCT(CMS_TRAVEL_BILLS.billId) FROM CMS_TRAVEL_BILLS in class edu.gettysburg.beans.TravelBill, CMS_TRAVEL_REQUESTS in class edu.gettysburg.beans.TravelRequest WHERE CMS_TRAVEL_BILLS.billId = CMS_TRAVEL_REQUESTS.billId AND CMS_TRAVEL_REQUESTS.shuttleDatetime > to_date('6 2009','MM YYYY')) ORDER BY BILL_ID ASC ] ---end error--- Notes: Using Oracle. Need a solution that does not require any Java coding, SQL ... |
69. from clause is not working forum.hibernate.orgHi to all, i am using from clause but it is not working ,i get null value , select query works fine. When i use from i get following message " Hibernate: select address0_.id as col_0_0_ from ADDRESS address0_ null " this is my code plz tell me where is error package hiber.scr; import java.util.Iterator; import org.hibernate.*; import org.hibernate.cfg.*; import java.util.*; ... |