I'm trying to pull a single string from my sql table using a query in my JPA repository. I have a repository, service, and controller class. My repository query looks like
@Query(value = "SELECT title FROM table_name WHERE subject = term;", nativeQuery = true)
String getTitleBySubject(String term);
My service method looks like this
public String getTitleBySubject(String term) {
String title = (String) repo.getTitleBySubject(term);
return title;
}
My controller call is
service.getTitleBySubject("subject");
Why does this return null? This is printed to the console
