DEV Community

loizenai
loizenai

Posted on

Kotlin + SpringBoot JPA + MySQL- Save/retrieve Files/Images with @Lob annotation

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-springboot-jpa-mysql-saveretrieve-filesimages-lob-annotation

Kotlin + SpringBoot JPA + MySQL- Save/retrieve Files/Images with @Lob annotation

In the tutorial, JavaSampleApproach will show you how to create a SpringBoot Kotlin project that uses SpringJPA with @Lob annotation to save Files/Images to MySQL database.

I. Technologies

– Kotlin 1.2.20
– Apache Maven 3.5.2
– Spring Tool Suite – Version 3.9.0.RELEASE

  • MySQL – Spring Boot – 1.5.10.RELEASE

    II. Goal

    – We create a SpringBoot project to save files/images to MySQL database as below structure:

Kotlin Spring JPA save Files Images to MySQL - pre

Create MySQL table:

Kotlin Spring JPA save Files Images to MySQL - create mysql table

-> Run and check results:

Kotlin Spring JPA save Files Images to MySQL - result

Kotlin Spring JPA save Files Images to MySQL - goal

III. Practice

Step to do:
– Create SpringBoot Kotlin project
– Create data model
– Create JPA Repository
– Implement Client to save/retrieve files/images
– Configure JPA connection & MySQL script

1. Create SpringBoot Kotlin project

Using SpringToolSuite to create a SpringBoot project with dependencies:

More at:

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-springboot-jpa-mysql-saveretrieve-filesimages-lob-annotation

Top comments (0)