Problem description: If the parameter in the hql statement is Chinese, it is garbled after execution.
Solution: add the following statement to hibernate. cfg. xml:
<Property name = "hibernate. query. factory_class "> </P> <p> Org. hibernate. hql. classic. classicquerytranslatorfactory </P> <p> </property> <br/>
In this way, the input parameters are garbled.
This solves the problem of Chinese garbled characters in the hql statement. However, if you use the hibernate update method, an error is returned.
Cause: the property of hibernate. query. factory_class is the factory class for configuring the Hibernate query translator. The above configuration is hibernate2.x. hibernate does not support the updated hql at 2.x. In hibernate3.x, the default translator is 3, but if the hql statement contains Chinese characters, it will be garbled.
Solution: when writing hql, use the setxxx method of query.