Answer the question
In order to leave comments, you need to log in
How to search in a database not by id in Spring Boot?
Good day, dear ones. There is this code:
@GetMapping("/notes/{id}")
public ResponseEntity<Note> getNoteById(@PathVariable(value = "id") Long id) {
Note note = noteRepository.findOne(id);
if(note == null) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok().body(note);
}
Answer the question
In order to leave comments, you need to log in
Create in noteRepository methodNode findBySecretKey(String secretKey);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question