Getting `Long cannot be converted to Example<S>` in Spring 5 JPA findOne()

Viewed 3417

I'm getting an argument mismatch; Long cannot be converted to Example<S> on the findOne call in the code below:

public Optional<AuditEvent> find(Long id) {
    return Optional.ofNullable(persistenceAuditEventRepository.findOne(id))
        .map(auditEventConverter::convertToAuditEvent);
}

The above code is being converted to Spring 5 and Spring Boot 2. It works fine in the original Spring 4 and Spring Boot 1 application.

Any ideas what I need to convert the above code to?

2 Answers

You can also use getOne() instead of findOne()

Related