Software Development

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 file.


The following codes are from our main Spring Boot class.




Download the codes


You Might Also Like


  1. 1

    Hi – you seem to be missing the Stored Procedure call in your database definition. @Procedure in your PersonRepository is pointing to “addPerson(…)”

  2. 2

Comments are closed.