Top "Jpql" questions

The Java Persistence Query Language (JPQL) is a platform-independent object-oriented query language defined as part of the Java Persistence API specification.

How to use multiple JOIN FETCH in one JPQL query

I have below entities: public class Category { private Integer id; @OneToMany(mappedBy = "parent") private List<Topic> topics; } public …

java hibernate jpa join jpql
How to retrieve only certain fields of an entity in JPQL or HQL? What is the equivalent of ResultSet in JPQL or HQL?

In JPQL, I can retrieve entities by : query = entityManager.createQuery("select c from Category c"); List<Category> categories = …

hibernate orm hql jpql
How to do a timestamp comparison with JPA query?

We need to make sure only results within the last 30 days are returned for a JPQL query. An example follows: …

jpa jpql openjpa
@OneToMany mappedBy maps to _____

What does mappedBy map to? Or, rather, what should it map to? The headers field below maps to @Entity Foo …

java jpa annotations one-to-many jpql
jpql date comparison today

I need a jpql query to find all the LoadFileHistory which finishDate be greater than the currente date (since 00:00:00). For …

java jpa jpql
How to write JPQL SELECT with embedded id?

I'm using Toplink essentials (JPA) + GlassFish v3 + NetBean 6.9 I have one table with composite primary key: table (machine) ---------------- |PK …

java jpa jpql composite-key
Using the JPA Criteria API, can you do a fetch join that results in only one join?

Using JPA 2.0. It seems that by default (no explicit fetch), @OneToOne(fetch = FetchType.EAGER) fields are fetched in 1 + N queries, …

java jpa jpql criteria-api
Limit number of results in JPQL

How it is possible to limit the number of results retrieved from a database? select e from Entity e /* I …

java jpa jpql
Java: JPQL date function to add a time period to another date

SELECT x FROM SomeClass WHERE x.dateAtt BETWEEN CURRENT_DATE AND (CURRENT_DATE + 1 MONTH) In the above JPQL statement, SomeClass …

java date documentation jpql
JPA concat operator

Is there a JPA concat operator for string concatenation? I know there is a JPA CONCAT function, however its ugly …

java jpa jpa-2.0 concatenation jpql