java - IntelliJ is too smart for me -


i'd implement simple jpa named queries intellij idea using final strings defined parameters. inspector do't , told me 'unexpected token' ':' on end of first part of query. how can suppress inspection or how can convince inspection accept that.

@namedqueries({   @namedquery(name = taxonentity.selectbytaxonid,   query = "select t taxonentity t t.taxonid  =:" + taxonentity.taxon_id) }) @entity public class taxonentity {  static public final string selectbytaxonid = "taxonentity.selectbytaxonid"; static public final string taxon_id = "taxonid"; .... } 

thanks in advance,

medrod

update: intellij idea accept query if after constant string appended.

@namedqueries({ @namedquery(name = taxonentity.selectbytaxonid, query = "select t taxonentity t t.taxonid =:"+taxonentity.taxon_id+"") }) 

try instead

@namedqueries({   @namedquery(name = taxonentity.selectbytaxonid,   query = "select t taxonentity t t.taxonid = " + taxonentity.taxon_id) }) @entity public class taxonentity {     static public final string selectbytaxonid = ":taxonentity.selectbytaxonid"; 

alternatively may want make whole query constant. it'd bit more readable.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -