1:Hibernate中如何指定字符的编码?
答:在hibernate.cfg.xml文件通过连接字符串指定:
<!-- Database connection settings --> <property name="connection.driver_class"> com.mysql.jdbc.Driver </property> <property name="connection.url"> jdbc:mysql://localhost:3306/hrsys?characterEncoding=GBK </property>
<property name="connection.username">test</property> <property name="connection.password">test</property> |