我正在将旧版本的Spring应用程序迁移到最新的Spring Boot应用程序。在旧的Spring应用程序中,我们使用hbm.xml和orm.xml以及persistance.xml以及Namedqueries.xml文件。
我已将所有xml文件转换为相应的bean但是想要使用Namedqueries.xml,因为我不想使用注释转换这些查询。这可能吗?
答案 0 :(得分:0)
You can use orm.xml that allows you to define JPA mappings in XML. This approach is equivalent and overrides annotations.
<entity class="com.example.Employee">
<table name="Employee.findAll" />
<named-query name="findAll">
<query><![CDATA[
SELECT e
FROM Employee e
]]></query>
</named-query>
</entity>