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

how to add one day to sql date?

i wanto get the trip which is happened between contractStartdate and contractEndDate+1day. but this following code gives me error. def tripsForThisContract = Trip.executeQuery("From Trip where contract_id = ? AND startDate between ? AND…
maaz
  • 3,534
  • 19
  • 61
  • 100
1
vote
1 answer

How to replace rows in Hive database using HQL

I'm trying to filter out a hive database df project schedule timestamp p1 1 t1 p1 2 t1 p1 3 t1 p2 1 t2 p2 2 t2 I want to replace rows in this data in such a way that the…
hbabbar
  • 947
  • 4
  • 15
  • 33
1
vote
1 answer

How to retrieve multiple entries from table into one list?

thanks for helping ;) I'm new to hibernate and wanna try it for my private project. What i want to do is: I want to have a class like public class Playlist { private long id; private String name; private long owner_ID; private…
DragonCoder
  • 172
  • 2
  • 12
1
vote
1 answer

Spring Data JPA: LOWER() or UPPER() with IN clause in HQL

Here I'm trying to do a case-insensitive search on a column "code", based on a collection of Strings. But it fails during HQL Validation, under SQLFunctionRegistry.java. I'm using Oracle DB. @Query(value = "SELECT A FROM A WHERE bro = :bro AND…
aayoustic
  • 99
  • 9
1
vote
3 answers

Failed to convert from type [java.lang.String] to type [java.lang.Long] for Spring JPA?

I have a problem about implementing two entities named for Country and State in Spring JPA. I wrote a code to pose Country and State entities shown below. Country Entity @Entity @Table(name="COUNTRY",catalog…
S.N
  • 2,157
  • 3
  • 29
  • 78
1
vote
1 answer

HQL - need help on query

I have entities: Tweet and User. Tweet has an author, which is an instance of User class. User is following others users and also keeps track of users following him: @ManyToMany public List following; @ManyToMany(mappedBy = "following",…
jjczopek
  • 3,319
  • 2
  • 32
  • 72
1
vote
0 answers

Custom HQL Function with param and single quote

I'm trying to write a custom function in hibernate to use ts_vector (postgres), my code so far: public class PostgresSQLFTSFunction implements SQLFunction { static final Logger LOG = LogManager.getLogger(); @Override public boolean…
Leonardo
  • 3,141
  • 3
  • 31
  • 60
1
vote
1 answer

Stored procedures in HQL

How can I write stored procedure or function in HQL? Is it possible? I haven't found any information about it. The problem is that my app works with several Databases(Oracle, MSSQL, PostgreSQL) and I need to count Levenshtein distance in my query.…
1
vote
2 answers

HQL Constructor With FETCH JOIN

Assuming I have a class like: public class Primary { private int id; private Secondary secondary; private String otherMember1; private float otherMember2; etc... } I'm trying to create a DTO projection with a constructor in HQL…
Valevalorin
  • 390
  • 1
  • 3
  • 18
1
vote
1 answer

how map join query columns to a class using hibernate?

I tried to create a query that returns different columns from two tables, and I want the query columns to be mapped to the user definition class. my Student Model : package com.example.demo.models; import javax.persistence.*; import…
Hamid
  • 239
  • 3
  • 12
1
vote
1 answer

case insensitive issue while fetching records from child table using HQL

I have a parent table and a child table where I am only getting 1 record from child table but not getting case insensitive matched record which is a mixed string. I am expecting it should return 2 records. Below is the code for the same. //parent…
ACP
  • 11
  • 2
1
vote
1 answer

Hibernate Envers: antlr.NoViableAltException: unexpected token: by

My core project package starts with "by.", so when implementing custom revision entity like this @Entity @RevisionEntity(BaseRevisionListener.class) public class BaseRevision extends DefaultRevisionEntity { } and then AuditQuery query =…
1
vote
1 answer

Hive - How to read a column from a table which is of type list

I have a Hive table named customer, which has a column named cust_id of list type, with following values: cust_id [123,234,456,567] [345,457,67] [89,23,34] Now I want to read only this specific column cust_id in my select query, which can…
akki
  • 71
  • 7
1
vote
1 answer

Passing Arraylist to SQL query to get the desired result

I wrote a query like this: select agent_id,count(id) as agentCount from demo.table lst where lst.agent_id in(:idpList) group by agent_id order by agentCount ASC; but this only returns the agent_id which are in idp List i also want to get the ids…
1
vote
1 answer

Table is not Mapped In HQL query

My class begins with: @Entity @Table(name = "validate_info", catalog = "company") @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id") public class ValidateInfo implements java.io.Serializable{ And my HQL…
user12813675