30 Aug

Spring Data JPA Entity Graphs

One of the important features in JPA 2.1 is the ability to specify fetch plans using Entity Graphs. This is useful since it allows you to customize the data that is retrieved with a query or find operation. It is expected to display data from the same entity in different and several ways when working with mid to large size applications. In other cases, you just need to select a smallest set of information to optimize the performance of your application.

Typically you do not have many mechanisms to control what is loaded or what is not loaded in a JPA Entity. You could use EAGER/LAZY fetching, but these definitions are pretty much static. You are unable to change their behaviour at runtime when retrieving data, meaning that you are stuck with what was defined in the entity. Changing these amid development is a nightmare, since it can cause queries to behave unexpectedly. Another way to control loading is to write specific JPQL queries. Read More

15 Jun

Spring Data JPA CRUD Example

In this tutorial we will see Spring Data JPA CRUD example. Here we will use the embedded or in-memory HSQL database. For more information on HSQL, you can find here http://hsqldb.org/

In this example we will create full annotation based Spring standalone application.

You can also find another tutorial Embedded HSQL Database in Spring Application

Read More

Share