The parameters passed through the ValueList QueryMap are all string types, and in the hql of the ValueList configuration file, a field that assigns the value directly to an integer will be an error. In general, we will use transformation functions in HQL for processing, as follows:
Copy Code code as follows:
<entry key= "Areasinfoadapter" >
<bean parent= "Abstracthibernate30adapter" >
<property name= "Defaultnumberperpage" ><value>19</value></property>
<property name= "Statementbuilder" ><ref bean= "statementbuilderhql"/></property>
<property name= "Defaultsortcolumn" ><value>id</value></property>
<property name= "defaultsortdirection" ><value>desc</value></property>
<property name= "HQL" >
<value>
from Com.berheley.hcms.persistence.model.TBaseAreas as TB
where tb.status= ' 1 '
/~hid:and tb.hid = to_number{hid} ~/
/~oid:and tb.oid = to_number{oid} ~/
ORDER BY Tb.code ASC
</value>
</property>
<property name= "Defaultfocuspropertyobjectalias" ><value>vo</value></property>
<property name= "Maxrowsforfocus" ><value>160000</value></property>
<property name= "removeemptystrings" ><value>true</value></property>
</bean>
</entry>
This method is more troublesome, in all the integer fields need to add function processing, and the database migration will be incompatible with the function of the problem. You can use the ValueList configuration to unify the fields of an integral type, and valuelist the configured parameters before assembling the SQL. As follows:
Copy Code code as follows:
<bean id= "integersetterhql" class= "Net.mlw.vlh.adapter.hibernate3.util.setter.IntegerSetter" ></ Bean>
<bean id= "statementbuilderhql" class= "Net.mlw.vlh.adapter.hibernate3.util.StatementBuilder" >
<property name= "Setters"
<map>
<entry key= "uId" ><ref bean= "integersetterhql"/> </entry>
<entry key= "oId" ><ref bean= "integersetterhql"/></ENTRY>
</map>
</property>
</bean>