从属性文件加载JPA存储库查询

我需要从属性文件中加载存储库中的查询。 例如,这里:

@Repository public interface StudentRepository extends JpaRepository { @Query(value="SELECT * FROM student where year= :le", native=true) public List getStudentsByLevel(@Param("le") int level); } 

我需要从属性文件中加载"SELECT * FROM student where year= :le"字符串。 有什么办法吗?

如上所述,我通过使用xml配置的命名查询克服了这个问题。 以下是示例。

persistence.xml中

     META-INF/jpql/mysql-quries.xml   

MySQL的-quries.xml

     SELECT * FROM student where year= :le    

在oracle-quries.xml和mysql-quries.xml中,我分别定义了所有本机查询。 当我需要在不更改类文件的情况下更改查询时,我只需要提及我需要在persistence.xml中使用的文件名。