java spring named query and property file -


how use named query. example:

public interface extends base<someclass, long> {    @query(value = "select sum(d.is_open) vw_view d d.value=?1", nativequery = true)    someclass getvalue(long value); } 

how can save sql query properties file (not xml, not in java class) , send name parameter?

could proceed example:

this generic select query on basis of primary key

query1=select {0} {1} {2} = {3} 

then can @ time of retrieving query can use this

 property = messageformat.format(query1,new string[]{"org_id","organization","primary-key","454545452"}); 

similarly can generalize queries , set values in java code. depends on level of generalization want.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -