JPA

In this short Spring Data JPA tutorial, you will learn how to create a JPA Native SQL Query to select specific columns only. JPA Native SQL Query to Select Specific Columns Below is an example of JPA Native Query that selects from a database table called Users only two columns: first_name and, last_name @Query(value=”select first_name,…

Read More Select Specific Columns with JPA Native Query

In this short Spring Data JPA tutorial, you will learn how to use the LIKE % expression in a Native SQL Query. When using advanced SQL LIKE expression the % sign in the SQL query would represent zero, one or multiple characters. Let’s have a look at the Native JPA SQL Query that uses advanced…

Read More How to Use LIKE % Expression in JPA SQL Query

In this short Spring Boot tutorial, I am going to share with you how to make Spring Boot app show Hibernate SQL Queries. Enable Hibernate SQL Queries Logging To show hibernate SQL queries in Spring Boot log file you will need to update the application.properties file with the following details: logging.level.org.hibernate.SQL=debug Show SQL Values Additionally,…

Read More Show Hibernate SQL Query in Spring Boot

In this short Spring Data JPA tutorial, you will learn how to write a Native UPDATE SQL query. Let’s assume you need to run the following SQL query: update users u set u.EMAIL_VERIFICATION_STATUS = ‘true’ where u.USER_ID = ‘5JwQBHd1mL73XEg8S2e2w4ITn9gOW4’ I assume you will not want to hardcode the values of EMAIL_VERIFICATION_STATUS and USER_ID into SQL…

Read More Spring Data JPA Native UPDATE SQL Query

In this Spring MVC tutorial, you will learn how to implement pagination in your RESTful Web Services app built with Spring MVC. The code example below will demonstrate how to implement pagination to implement “Get a list of users” registered with our app feature. I assume you already have your Spring MVC RESTful Web Service…

Read More REST Pagination Tutorial with Spring MVC

In this blog post, I am going to share with you how to configure Spring Data JPA in a Jersey 2 Container Deployable Web App. Spring Data JPA makes it much easier and more convenient to persist and read data from the database and when I needed to tie together Spring Data JPA and Jersey 2 Web…

Read More Configure Spring Data JPA in Jersey 2 JAX-RS App

With this blog post, I am going to share what I needed to do to make JPA work in my Jersey 2 Web Services App. I have created my Jersey 2 app using the following maven snippet: mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \ -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.26 I then opened pom.xml and added a few new dependencies which I…

Read More Configuring JPA in Jersey 2 Web App

Create a Servlet Container deployable Jersey web application Create new Jersey web application using Maven. The project created with the below jersey-quickstart-webapp archetype can be built and deployed to a servlet container like for example Apache Tomcat. mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \ -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.26 POM.XML Dependency to Support JSON To support JSON in your Jersey Web App add…

Read More RESTful Web Services with Jersey and Spring Data JPA – Cheat Sheet