<commit_before>---
layout: post
title: Query by Example in Spring Data
categories:
- java
- jsf
tags: []
status: publish
type: post
published: true
---
We are currently using Spring Data JPA in a project and really love it. Lately we came across a feature we sort of oversaw so far in Spring Data's excellent documentation and we definitely wanted to sure with you. 

Before we start, we first have to create some context. We use Spring Data in a Spring Boot based JSF application. We often have the requirement to show data in a Data-Table (for that we use [PrimeFaces](http://primefaces.org/)) based on the field values of a search form. In our code we follow the approach to create an empty domain object in the view class acting as our backing object that provides us with the search parameters. 

Here is an example. This is our view class:<commit_msg>fixed typo<commit_after>---
layout: post
title: Query by Example in Spring Data
categories:
- java
- jsf
tags: []
status: publish
type: post
published: true
---
We are currently using Spring Data JPA in a project and really love it. Lately we came across a feature we sort of oversaw so far in Spring Data's excellent documentation and we definitely wanted to share with you. 

Before we start, we first have to create some context. We use Spring Data in a Spring Boot based JSF application. We often have the requirement to show data in a Data-Table (for that we use [PrimeFaces](http://primefaces.org/)) based on the field values of a search form. In our code we follow the approach to create an empty domain object in the view class acting as our backing object that provides us with the search parameters. 

Here is an example. This is our view class:
{'fraction_non_alphanumeric': 0.04906542056074766, 'fraction_numerical': 0.0, 'mean_word_length': 4.008771929824562, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4424098', 'n_tokens_mistral': 425, 'n_tokens_neox': 416, 'n_words': 286}