import org.springframework.stereotype.Repository;
@Repository
public interface CustomRepository extends JpaRepository<Object, Long> {
@Query(value = "SELECT name FROM student", nativeQuery = true)
List<String> getAllStudentNames();
}
这将工作,如果没有什么将是解决方案?我不想创建学生团体。
1条答案
按热度按时间bwntbbo31#
如果你没有Student类,那么你不应该为它创建一个JpaRepository。这是我的建议: