Questions tagged [hql]

For questions concerning "Hibernate Query Language" (HQL), a query language used by Hibernate and NHibernate. Use the tag [hiveql] for questions about Hive Query Language.

HQL, acronym for "Hibernate Query Language", is a powerful, object oriented query language used by the Hibernate and the NHibernate object relational mappers.

It is used in Java environments and is heavily inspired by SQL. Its syntax resemble SQL queries, but operates with Java Persistence API (JPA) entity objects rather than directly with database tables.

HQL can also be used on platforms such as Adobe ColdFusion

5074 questions
1
vote
1 answer

Hibernate HQL and fetching with grouping

We have a hibernate pojo Reporting/ReportingID that has several properties that contain counts, dates, actions, and devices. The device property mapped to a hibernate pojo called Device (note: I want it to fetch the device so I don't have to query…
arinte
  • 3,660
  • 10
  • 45
  • 65
1
vote
4 answers

Getting Invalid parameter index 1 from simple HQL query

I have the following HQL query and for simplicity sake lets assume the mappings and table names are correct. String queryString = "from entity as vv inner join vv.childentity as vis with childentityid=?"; Query query =…
maple_shaft
  • 10,435
  • 6
  • 46
  • 74
1
vote
1 answer

Nested select for aggregate jsonb children, SQL/HQL

I have such task: in spring/hibernate/postgres I have a entity(aggregate) that contains jsonb with children codes. Like in a container can be 100 blocks of sigarets, every one contains 10 packs and all of them (all 3 level) everyone have a uniqe…
Zorg
  • 61
  • 4
1
vote
2 answers

How to write a HQL select query using extractvalue function in select clause of query in Java?

I'm writing code with hibernate wherein I have to use the MySQL extractvalue function, in the SELECT clause of the query. However, I am getting the error: java.lang.IllegalArgumentException: org.hibernate.QueryException: No data type for node:…
jaihind
  • 1,090
  • 1
  • 8
  • 9
1
vote
2 answers

Why does HQL cause a "class not mapped" exception?

I have a method which is trying to use HQL to do a rather complex query within the database. My entity classes are all mapped with annotations and are discovered during compilation, not explicitly listed. In the code which follows: List
Bret
  • 1,455
  • 2
  • 16
  • 27
1
vote
1 answer

Hibernate query compare comma separated string with list

Problem I am developing a spring-boot application that needs to read data from an oracle database. The database itself is outside of my control and I cannot change the way it's structured. I'm using spring-data-jpa in combination with hibernate to…
1
vote
1 answer

HQL does not return values even though generated SQL does

I am facing this somewhat weird issue. (Maybe I don't understand it). I have the following HQL query. "select distinct b " + "from Booking b " + "inner join fetch b.telephoneNumber tp " + "left join fetch tp.patients p " + "where b.concluded = false…
Jayanga Kaushalya
  • 2,674
  • 5
  • 38
  • 58
1
vote
3 answers

HQL query not working, Incorrect syntax near ',' error. Using Spring and Hibernate

I am trying to execute following update query and getting error, Query is= @Transactional public List getClosedOrders(String userID) throws DataAccessException { try { String SQL_SELECT_QUERY = "from Order as o where o.orderStatus='closed'…
Sagar
  • 1,242
  • 7
  • 22
  • 49
1
vote
0 answers

Joining Multiple different tables on Hibernate

I've created a software on Spring MVC and Mapped more than 25 tables. I only use lazy loading. Now I'm struggling with the joins. Can someone help me? I know how to do all joins in regular SQL but HQL is killing me. Here are the two Beans: package…
1
vote
1 answer

Select new list of subquery in hql

I am trying to use the subquery in the attributes section. This works fine when the subquery returns only one result. Otherwise it shows an error. [2019-12-30 11:24:26] [21000] ERROR: more than one row returned by a subquery used as an…
1
vote
1 answer

how to extract a part of a string in hive

I have a column called desc and it contains the below string : BUY 20 SAVE 5 Desired output: 20 I tried: SELECT desc, split (desc, 'Y\\s')[1] as Revenue FROM table1;
Mona
  • 273
  • 1
  • 2
  • 13
1
vote
1 answer

Convert a SQL query to hql

I need to convert this query to hql to use it my code : SELECT DISTINCT certificate_id , last_scan FROM bcs_certificate_instance ORDER BY last_scan LIMIT 5 ; Who can help please?
Hana_CH
  • 105
  • 1
  • 12
1
vote
1 answer

hibernate inner join

i need inner join with "select rc.* from" "from RateCode rc inner join rc.rateCodeParams rcCod where rc.rateCodeId = rcCod.id and rc.travelFrom <= '2011-05-09' and rc.travelTo >= '2011-05-13' and rc.active = 1" + " and rcCod.paramVal like…
Ravi Parekh
  • 5,253
  • 9
  • 46
  • 58
1
vote
2 answers

HQL Many to Many how to query

i have two entities : Customer and User. They have a many to many relationship. Assume I have the following data in database. Customer ------------- id | name 1 | customer User ------------- id | name 1 | user1 2 | user2…
user744574
  • 41
  • 2
  • 4
1
vote
1 answer

Hibernate: How to query to an object which it's collection proprty contains a specific value?

I've got a Player Object in which there is a Collection. I'm willing to write a hibernate query which returns the list of players who have a specific stock (for example stock.symbol="**"). any ideas?
SJ.Jafari
  • 1,236
  • 8
  • 27
  • 39
1 2 3
99
100