Missing CrudRepository#findOne method

Andrii Abramov picture Andrii Abramov · May 21, 2017 · Viewed 51.1k times · Source

I am using Spring 5 in my project. Until today there was available method CrudRepository#findOne.

But after downloading latest snapshot it suddenly disappeared! Is there any reference that the method is not available now?

My dependency list:

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'


repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}    

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-data-jpa'

    runtime 'com.h2database:h2:1.4.194'
}

UPDATE:

Seems that this method has been replaced with CrudRepository#findById

Answer

Sean Carroll picture Sean Carroll · May 22, 2017

Please see DATACMNS-944 which is associated to this commit which has the following renames

╔═════════════════════╦═══════════════════════╗
║      Old name       ║       New name        ║
╠═════════════════════╬═══════════════════════╣
║ findOne(…)          ║ findById(…)           ║
╠═════════════════════╬═══════════════════════╣
║ save(Iterable)      ║ saveAll(Iterable)     ║
╠═════════════════════╬═══════════════════════╣
║ findAll(Iterable)   ║ findAllById(…)        ║
╠═════════════════════╬═══════════════════════╣
║ delete(ID)          ║ deleteById(ID)        ║
╠═════════════════════╬═══════════════════════╣
║ delete(Iterable)    ║ deleteAll(Iterable)   ║
╠═════════════════════╬═══════════════════════╣
║ exists()            ║ existsById(…)         ║
╚═════════════════════╩═══════════════════════╝