Hibernate libraries with JPA specification

Asked

Viewed 153 times

-2

I am using JPA and Hibernate and encountering difficulties regarding querys errors. I wonder if there is a specific JPQL library? and what are necessary for projects to sound this profile.

1 answer

1


(JPQL) Java Persistence Query Language

It is a platform-independent object-oriented query language defined as part of the Java Persistence API (JPA).

As a specification, we don’t have to bring a specific lib, it’s already in spec.

Querydsl JPA

It is a framework that allows you to build type-safe SQL queries for various backends including JPA, Mongodb and SQL in Java.

Instead of writing queries like inline strings or externalizing them into XML files that are built through a fluent API.

Example with Querydsl

QCustomer customer = QCustomer.customer;
JPAQuery query = new JPAQuery(entityManager);
Customer bob = query.from(customer)
  .where(customer.firstName.eq("Bob"))
  .uniqueResult(customer);

It’s that simple, and this might be a good option for you to make your queries in JPA. Follow the link from his website:

Website

  • Brother, I’m not interested in a new query syntax. would like to know if in the libraries of the Hibernate provider would have any need to support JPQL.

  • As a specification, we don’t have to bring a specific lib, it’s already in spec.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.