Questions tagged as 'jpql'

1
answer

How to query in ManyToMany tables?

I have two tables / entities in the database with the following attributes: Car (code, plate, color) Accessory (code, description). public Carro buscarCarroComAcessorio(Long codigo) { return (Carro) em.createQuery("select c from Carro...
asked by 07.10.2015 / 15:28
2
answers

Is it possible to limit the amount of rows of a class attribute that is a list via JPQL?

I have the following query in JPQL FROM User u INNER JOIN FETCH u.enderecos e WHERE u.id =:id ORDER BY e.id DESC A user can have more than ten addresses, so we want to bring only ten addresses and if the user wants, he loads ten times. I...
asked by 25.08.2014 / 19:58
1
answer

JPA subselect in MANYTOMANY

I'm developing a system with java + jpa + mysql but now I have a question that I still can not find the answer ... Given the tables and entities below, I would like to set up a jpql to perform the following query in native SQL: SELECT * FROM p...
asked by 24.09.2015 / 20:20
1
answer

query executes in bank but in project points error

I have a query native: SELECT dist.nome Distrito, enti.nome Entidade, dist.id_distrito, dist.codigo_dne, dist.id_entidade, dist.id_municipio, dist.id_uf, dist.flag_ativo, muni.nome Municipio, unfe.nome UF...
asked by 05.10.2017 / 13:52
1
answer

JPA make a join of a table that has attribute @manyToOne and @ManyToMany

I am having a question regarding table joins, I have a sales class the same as Customer, Buy, ProductList. I would like to make a report with product name, customer name, product value and date of purchase only I do not have the slightest idea h...
asked by 27.04.2018 / 19:23
1
answer

Search in associative table

How can I search the associative table? There are two entities, Person and Time. From where I created the associative Person_Time that has id_people and id_time. My goal is to list all the id_time of a certain people_id Next error: HTTP...
asked by 12.07.2016 / 16:18
1
answer

Hibernate Cache with select count

Hello I have a JPQL query, with count : public Long quantidadeFaturasAbertasAssinante(Integer idAssin){ return manager.createQuery("select count(f) from Fatura f where f.dataLiquidacao IS NULL and f.assinante.id = :ass", Long...
asked by 11.10.2016 / 21:06
2
answers

Select JPA and Hibernate

I have five entities (Quotation, Sector, Partner, Items and Leads), where the user will select a quotation and sector and the list of all items related to this sector will appear along with the items that have already been posted ( if any). I...
asked by 21.08.2015 / 04:36
1
answer

How to do custom query with JPA + Hibernate

Hello, I would like to know an elegant way to make a custom query using JPA . Basically I want to run the query and return it to an object list, but usually it will be a query with N tables and only with the fields I will need. I und...
asked by 15.01.2015 / 18:59
2
answers

Select join with JPQL

Talk the guys! I'm grating here in my TCC and need some help. I know the problem that I am must be very silly, but I do not have much knowledge. I searched everywhere, JPQL documentation and everything, but I could not solve it. I need to log...
asked by 24.11.2017 / 00:07