Category: JPA 2

JPA @EmbeddedId example

Hello, in previous article we have seen how compound primary keys can be generated using @IdClass annotation. This article gives JPA @EmbeddedId example i.e. another way of creating compound primary keys.   JPA @EmbeddedId example: Consider Employee entity such that.…

JPA @IdClass example

We know that a database table can contain compound primary keys. i.e. the primary key is composed of more than one columns. Compound primary keys can be created in JPA in two ways, using @IdClass and @EmbeddedId annotation. Here, we…

Criteria group by clause

Just like JPQL, Criteria group by clause is used to group and filter the results. Criteria group by clause: In our article about jpa group by clause, we’ve seen how jpql can be used to group the number of teachers…

criteria order by clause

We can order the results of a query according to some condition. Criteria order by clause enables us to order the results of criteria query. Criteria order by clause: We have seen how to order the results using JPQL in…

Criteria case expressions

We have learned about case expressions in jpa and what are the benefits provided by it. This article will deal with criteria case expressions. Criteria case expressions: In the example given in the article about jpa case expressions our objective…

Criteria api joins

We have seen how to perform inner joins and outer joins using jpql. Let us see what criteria api joins are and how we can create criteria api joins. Criteria API Joins: Criteria api joins can be performed with the…

JPA ParameterExpression

Consider a situation when the conditional expression for a query is not known at compile time. Some runtime information needs to be passed to the query to get results. We can achieve this using JPQL and criteria api. This article…

multiselect in criteria api

Using multiselect method for selecting multiple expressions is one of the ways from the ways we’ve seen in previous post about tuples This article will deal with multiselect in criteria api. Multiselect in criteria api: When you want to only…