Spring data JPA findOne () returns null

0

I'm developing an application using Spring MVC, with spring data jpa in the persistence layer.

When I try to do a search using the method findOne (or findById ) will always return null.

I already checked the database and there is a registered record with the indicated Id.

Method call:

public Atividade findById(short id) {
    return atividades.findOne(id);
}

Error while trying to search:

  

java.lang.NullPointerException: null       at br.com.transformare.service.AtivityService.findById (ActivityService.java:32)

Can anyone tell me if it would be some error in my code or some spring data bug?

    
asked by anonymous 30.05.2017 / 04:59

1 answer

0

Create a repository with the following call in the database

Atividade findById(short id)

and use it instead of findOne

Tip: work id as Long and not as short

    
26.11.2017 / 23:16