<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Spring Data on pieterjd.be</title><link>https://pieterjd.github.io/tags/spring-data/</link><description>Recent content in Spring Data on pieterjd.be</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Tue, 11 Jun 2019 19:16:00 +0000</lastBuildDate><atom:link href="https://pieterjd.github.io/tags/spring-data/index.xml" rel="self" type="application/rss+xml"/><item><title>How to check if a row with a specific column value exists in Spring Data</title><link>https://pieterjd.github.io/posts/2019-06-11-jpa-check-if-row-exists-with-property-value/</link><pubDate>Tue, 11 Jun 2019 19:16:00 +0000</pubDate><guid>https://pieterjd.github.io/posts/2019-06-11-jpa-check-if-row-exists-with-property-value/</guid><description>Spring Data has a great declarative way of defining queries, called derived queries. Suppose you have a Person class with an email field. Then you can define the following method in a Repository interface:
public interface PersonRepository extends JpaRepository&amp;lt;Person,Long&amp;gt;{ List&amp;lt;Person&amp;gt; findByEmail(String email); } Spring derives the query based on the method name, in this case a query to retrieve all persons with a given value for the email field.
As you can see, the method returns a List.</description></item></channel></rss>