Questions tagged as 'hql'

2
answers

How to perform a SUM in Hibernate

I'm trying to do a select via HQL but Java can not identify SUM by generating the following error: java.lang.NullPointerException at org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions$SumFunction.determineJdbcTypeCode(StandardA...
asked by 19.02.2016 / 23:02
1
answer

How to insert a String variable into a hql?

I need to make a query in the database and return only the values based on the variable, my code returns the list with all the data of the city field, I want to return only the cities based on the state that the user select first. The state retu...
asked by 22.10.2014 / 13:29
2
answers

Subquery in Java HQL

Hello, I'm in a project that uses geolocation and I'm doing a feature to list the stores closest to the location chosen by the user. I'm using the PostgreSQL database and did this query to perform the search: SELECT ID, CIDADE, CNPJ, DESCRICA...
asked by 07.09.2017 / 22:31
2
answers

Place default value in column

I need to leave a default value in this table column, I'm mapping the persistencies with Hibernate (summarizing the database is created according to the HQL / JPA that I define in domains. How do I set a default value for the column? @NotEm...
asked by 18.10.2016 / 18:17
1
answer

Query in HQL using Hibernate

How to make a query to return the result to below in HQL Result | quantidade | quantidade erro | desc | | 2 | 1 | TESTE 1 | | 3 | 2 | TESTE 2 | | 1 | 1 | TESTE 3...
asked by 06.07.2015 / 16:38
1
answer

Return search HQL JAVA

I have the following function that searches the DB for a user that satisfies the login and password passed by parameter: public Usuario getUsuarioLogin(String pLogin, String pSenha) { String hql = " select u from Usuario u "...
asked by 21.10.2018 / 01:24
1
answer

Query in JPQL / HQL query

I need to query in HQL and I have this Hibernate entity. @Entity @Table(name = "TB_TIPO_DOCT", schema = "FEP") @NamedQueries({ @NamedQuery(name = "TbTipoDoct.findAllDocumentosLiberados", query = "SELECT t FROM TbTipoDoct t WHERE t.cdSitu...
asked by 30.08.2018 / 21:25
1
answer

Joins with child entities

I have a parent entity called OCR, this has 2 that are specialization (inheritance): OCR_A, OCR_B. My hql needs to contemplate the 2, ie I need to join the 2. I start like this: select o from OCR o How do I join in the 2 child tab...
asked by 11.07.2018 / 14:34
1
answer

Doubts in HQL while doing Sum function

I have a question in hql. My system has 3 tables table1 and table 2 and table 3 table 3 stores the primary key records of table1 and table2 to make relationships. Table 1 can contain N associations with table 2 but table 2 can only belo...
asked by 15.03.2018 / 19:25
1
answer

Error trying to query via HQL

I have the following entities: import java.io.Serializable; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persis...
asked by 15.03.2018 / 17:50