-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathDBStudentService.java
More file actions
41 lines (31 loc) · 838 Bytes
/
DBStudentService.java
File metadata and controls
41 lines (31 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.alibou.springdemo.student;
import java.util.List;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
@Service
public class DBStudentService implements StudentService {
private final StudentRepository repository;
public DBStudentService(StudentRepository repository) {
this.repository = repository;
}
@Override
public Student save(Student s) {
return repository.save(s);
}
@Override
public List<Student> findAllStudents() {
return repository.findAll();
}
@Override
public Student findByEmail(String email) {
return repository.findByEmail(email);
}
@Override
public Student update(Student s) {
return repository.save(s);
}
@Override
public void delete(String email) {
repository.deleteByEmail(email);
}
}