public interface StudentRepo extends JpaRepository<Student, Integer> {
@Query(value = "SELECT Name FROM STUDENT WHERE UNIQID=?", nativeQuery = true)
public abstract _______ getStudentByUniqueKey(String uniqueKey);
}这里的返回类型是什么?
发布于 2018-11-24 13:12:23
您的StudentRep必须如下所示:
public interface StudentRepo extends JpaRepository<Student, Integer> {
@Query(value = "SELECT name FROM Student WHERE uniqid=:uniqid", nativeQuery = true)
public String getStudentNameByUniqueKey(@Param("uniqid")String uniqueKey);
}如果你想要获取学生对象:
@Query(value = "SELECT student FROM Student student WHERE student.uniqid=:uniqid", nativeQuery = true)
public Student findStudentByUniqueKey(@Param("uniqid")String uniqueKey);有关更多详细信息,请查看official doc
https://stackoverflow.com/questions/53455302
复制相似问题