hql Questions

4

Solved

In my Hibernate JPA Sample code.. public List<AttendeesVO> addAttendees(String searchKeyword) { TypedQuery<AttendeesVO> query = entityManager.createQuery(" select at from AttendeesVO ...
Pyrrhic asked 2/1, 2013 at 9:0

9

Solved

I want to perform data time operations using hibernate HQL. I want to add and subtract two dates as well as I want to subtract 1 year or 1 month from a particular date. How is this possible using...
Mogador asked 24/6, 2009 at 6:15

15

Solved

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 use setMaxResults if poss...
Anatase asked 6/8, 2009 at 15:33

1

Solved

I have a Java Spring application with lots of queries, which so far have worked until spring boot 3.2.0. Recently, after simply changing to spring boot 3.2.1, I started getting this kind of error: ...
Dentilabial asked 16/1, 2024 at 2:52

8

I am executing the following HQL and it is executing properly String hql = "FROM Employee"; Query query = session.createQuery(hql); List results = query.list(); Now, I also want to log the sql ...
Serenity asked 22/8, 2013 at 14:54

2

Solved

So How to check if a collection is null in HQL? Simple example: select * from Book book where title in (:titles) So if titles is a single variable, I can do select * from Book book where (:tit...
Amey asked 16/7, 2018 at 21:54

7

Solved

Please help me understand where to use a regular JOIN and where a JOIN FETCH. For example, if we have these two queries FROM Employee emp JOIN emp.department dep and FROM Employee emp JOIN FETCH e...
Rheo asked 2/7, 2013 at 16:50

5

Solved

I'm trying to write an HQL query to grab a list of users that belong to a particular organisation, or any franchisee from a list of franchisees, however hibernate isn't able to parse it. I can't fi...
Petta asked 3/7, 2014 at 10:26

4

Solved

I have a Spring Boot application and use Spring Data JPA to query a MySQL database. I need to get a list of courses filtered with some parameters. I usually use the syntax param IS NULL or (/*do ...
Jacobah asked 3/1, 2019 at 17:17

4

Solved

I am using HQL to get the data inserted exact 21 days from now. Here is my Code Query queryThreeWeek = session.createQuery("from Users where createdDate = CURDATE()-21"); List<Users> userDet...
Stillmann asked 11/7, 2016 at 14:5

6

Solved

I'd like to use Hibernate's criteria api to formulate a particular query that joins two entities. Let's say I have two entities, Pet and Owner with a owner having many pets, but crucially that asso...
Premillenarian asked 6/4, 2009 at 7:37

6

What is the difference between an INNER JOIN and LEFT SEMI JOIN? In the scenario below, why am I getting two different results? The INNER JOIN result set is a lot larger. Can someone explain? I...
Leek asked 12/2, 2014 at 20:21

6

Solved

I have written a query to delete some objects in my interface extending JPaRepository, but when I execute the query it throws an exception! Can anyone explain it for me? Query: public interface Lim...
Raja asked 17/5, 2017 at 10:19

3

Solved

I want to execute the below query in Hibernate? select count(*) from login where emailid='something' and password='something'
Babblement asked 29/6, 2013 at 18:57

3

Solved

I have the following classes: class User { hasMany = [ratings: Rating] } class Item { hasMany = [ratings: Rating] } class Rating { belongsTo = [user: User, item: Item] } I want to count ...
Armillas asked 13/9, 2013 at 17:1

3

Solved

I have a question with HQL query and hibernate. I have a user class and a role class. A user can have many roles. So I have a ManyToMany relatation like this: In user class: @ManyToMany(fetch = ...
Linnea asked 13/8, 2010 at 8:33

4

I'm working with hibernate and I'm having troubles creating an hql query that fetches all the children of my object. For example: The Object User has a list of Cars and a list of Friends. To get ...
Incite asked 7/3, 2012 at 18:40

3

Solved

I want to get expired entities from table using HQL. Something like that: select id, name from entity_table where date_creation + 10_minutes < current_time() I cant get how to do that with HQ...
Tybalt asked 26/11, 2012 at 16:25

5

Solved

I need a list with three columns. column 1st and 3rd having values while 2nd as null. Can I do it through HQL query? I need something like this: select id, null, name from MyClass Where MyClas...
Handiness asked 30/7, 2010 at 22:15

5

Solved

I use the following query to get a java.util.Map with indexes id, text and object: Query q = mySession.createQuery( "SELECT u.id AS id, u.name AS text, u AS object FROM User u") .setResultTransf...
Frerichs asked 16/4, 2011 at 12:20

5

Solved

I am retrieving data by CrudRepository in Spring Data JPA. I want to filter my records those are retrieved from my custom query provided in @Query annotation. I tried .setMaxResults(20); for select...
Mcgraw asked 3/12, 2017 at 8:2

3

I'm a partial UI developer, right now I need to turn into Hibernate development. Today I occurred a problem in HQL when I'm trying to use UNION ALL, here is the HQL: SELECT COUNT(DISTINCT users.us...
Egoism asked 18/8, 2013 at 6:7

2

Caused by: org.hibernate.QueryException: Could not resolve requested type for CAST : INT [ SELECT SUBSTRING(referenceComptable , 8, 14) AS seqNum, SUBSTRING(referenceComptable, 4,7) AS yearCegi...
Maziar asked 6/9, 2018 at 10:11

4

I'm unable to execute HQL for Inner Joins, Query is executing correct at sql but not in HQL. I don't know where i'm missing. Your help is appreciable. ***Error***: org.hibernate.hql.ast.QuerySynt...
Factor asked 25/2, 2013 at 13:54

9

How can I get row count from all tables using hive? I am interested in the database name, table name and row count
Jackijackie asked 20/2, 2014 at 7:21

© 2022 - 2025 — McMap. All rights reserved.