Code: Select all
Unexpected error occurred in scheduled task. org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.postgresql.util.PSQLException: ERROR: relation "my_table" does not exist
Funktioniert nicht:
Code: Select all
@Service
public class MyService {
private final MyRepository repository;
public MyService(MyRepository repository) {
this.repository = repository;
}
@Scheduled(fixedDelay = 3000)
public void updateDatabase() {
Foo foo = repository.findOne(id); // Throws exception
// ...
}
}
Code: Select all
@GetMapping("/test")
public ResponseEntity test() {
myService.updateDatabase();
// ...
}
Code: Select all
@Service
public class MyService {
private final MyRepository repository;
public MyService(MyRepository repository) {
this.repository = repository;
}
//@Scheduled(fixedDelay = 3000)
public void updateDatabase() {
Foo foo = repository.findOne(id); // No exception
// ...
}
}