问题描述
使用intellij想法2016-3.4,是否可以基于参数注入语言?考虑一下
Using intellij idea 2016-3.4, is it possible to inject a language based on a parameter? Consider this
@Query(nativeQuery = true, value = "select * from Foo")
List<Foo> nativeQuery();
@Query(value = "select a from Foo a")
List<Foo> hqlQuery();
第一个示例是本机mySql查询,因此我想注入mySql方言,而第二个示例是hql查询,在此我想注入休眠查询语言.
The first example is a native mySql query, so I'd like to inject mySql dialect, while the second one is a hql query, where I would like to inject the hibernate query language.
现在,如果我在两个查询字符串之一中注入一种语言,则两者都将变为该语言注入.
Right now, if I inject a language in one of the both query strings, both change to that language injection.
我可以让我理解@Query
批注中的nativeQuery
参数吗?
Can I make idea understand the nativeQuery
parameter in the @Query
annotation?
推荐答案
是的.
您不能在语言注入窗口中进行操作.
但是您可以使用 语言注入评论 或 @语言注释 .下面,我使用注释在同一注释中注入 MySQL 和 HTML :
But you can use language injection comments or @Language annotation. Below I inject MySQL and HTML in the same annotation using comments:
要删除评论,请按 + (OS X + ),然后选择Un-inject Language/Reference
To remove comment hit + (OS X +) and choose Un-inject Language/Reference
.
这篇关于使用@Query在intellij中进行语言注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!