0
I am 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
) returns always null.
I already checked in the database and there is the 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.Activitiesdeservice.findById(Activitiesdeservice.java:32)
Can anyone tell me if it would be some mistake in my code or some spring data bug?
Put more snippets of the code. Only with this you informed and difficult to understand. Preferably copy the method that is calling "activities.findOne(id)" and also where it shows the error (Activityjava:32)
– Doug Cunha
It seems that your "activities" object has not been instantiated/injected. As well noted by @Doug, enter the full code of the class.
– Murillo Goulart