Call Stored Procedure using Spring Data and @Procedure

This post demonstrates how to call Stored Procedure using Spring Data and @Procedure.


Stuff used in this post.

  • IntelliJ IDEA Ultimate 2016.3
  • Java 8
  • Windows 10 64bit
  • Spring Boot 1.5.6.RELEASE
  • Spring Initialzr
  • MySQL and MySQL Workbench

Spring Initialzr in IntelliJ IDEA

Database Table

First, we need to create a database table.

Create Stored Procedure

Entity and Repository

Then, we create our entity and repository.

Person entity


Note the method name here. It is the same as our Stored Procedure. @Procedure maps this method to that actual stored procedure.


Before we can access our database, we need a valid user account and the following properties set up in application.properties file.


The following codes are from our main Spring Boot class.


Download the codes


Karl San Gabriel

Karl San Gabriel

Professional Software Developer