Home » JPA JPQL Basic Operations

JPA JPQL Basic Operations

by Online Tutorials Library

JPA JPQL Basic Operations

JPQL allows us to create both static as well as dynamic queries. Now, we will perform some basic JPQL operations using both type of queries on the below table.

JPA JPQL Basic Operations

JPQL Dynamic Query Example

In this example, we will fetch single column from database by using createQuery() method .

StudentEntity.java

Persistence.xml

FetchColumn.java

Output:

JPA JPQL Basic Operations

JPQL Static Query Example

In this example, we will fetch single column from database by using createNamedQuery() method .

StudentEntity.java

Persistence.xml

FetchColumn.java

JPA JPQL Basic Operations

You may also like