spring-data


Alternatives to finder methods for every property in Spring JpaRepository


I use Spring Data JPA for my repository layer. I need to query entities by every possible property and combinations of its properties. So my typical repository looks like this.
public interface UserRepository extends JpaRepository<User, Long> {
User findByLogin(String login);
User findByEmail(String email);
User findByName(String name);
User findByLoginAndEmail(String login, String email);
User findByLoginAndName(String login, String name);
User findByLoginAndEmailAndName(String login, String email, String name);
//and so on
}
Even with three properties it looks ugly enough.
Are there any more flexible alternatives to this approach? Or this design is OK(at least I do not have to implements all of these methods)?
Found query by example. Seems it is what I was looking for.

Related Links

Why we need to create xxxCustom and xxxImpl class when we create repository?
subquery in spring jpa repository
Spring transactions for checked exceptions
Using Spring Data JPA and Spring Data Elastichsearch in same app with same Domain Object
SpringData MongoDB cannot determine IsNewStrategy during Auditing
jpa lazy return all element
setting spring data jedis connection pool using application.yml file
Stored Procedures with spring data jpa
Spring data mongodb: query and sort results based on difference of two fields
SpringXD module delete command does not delete the uploaded .jar file
Can spring data couchbase be used to access reduced views
Spring data jpa. Partial custom repository implemantation
Is it possble to write query at JPA entity property level
Cannot get connection for redisTemplate for Spring data redis
Predicate on a Map<String, String> field using spring-data-mongodb
Usage of ClassTypeInformation.from(..) inside MappingMongoConverter introduces much thread contention

Categories

HOME
spring-data
android-espresso
shinyapps
code-formatting
adobe
initialization
docker-cloud
web2py
header
dependencies
driver
fasm
match
fireloop
lapack
smooks
spring-jpa
sql-injection
pinterest
pickle
nose
yii2-basic-app
altium-designer
fluent-migrator
sipp
pdf.js
vuforia
unordered-multimap
python-appium
tf-idf
onchange
pyspark-sql
bitbake
materialize
unmarshalling
credit-card
location-services
progid
wampsharp
fotorama
creation
bluemixtools
aurelia-cli
extbase
optionaldataexception
elasticsearch-aggregation
common-table-expression
brightscript
non-linear-regression
scala-collections
emacs25
gmaps.js
pbx
metabase
e
nclam
raw-sockets
openseadragon
meld
enunciate
cortana
hmisc
wso2ml
darwin
angular-amd
webproject
scala-macros
azure-xplat-cli
fat32
cout
xcode6.3.1
lumia-imaging-sdk
coding-efficiency
nachos
screwturn
incognito-mode
django-settings
facebook-game-groups
vlab
yii-booster
sql-view
ember-table
microformats
jsplitpane
semantic-merge
word-frequency
mvcrecaptcha
server-variables
kext
rtd
android-2.1-eclair
tabbarcontroller
j2mepolish
subtext
downcasting
icon-language
jboss-mdb
activex-exe
gui-designer
code-camp
parentid

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App