配置数据库的URL<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message"/>,加上参数?useUnicode=true&characterEncoding=UTF-8
<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message?useUnicode=true&characterEncoding=UTF-8"/>
提示:The reference to entity "characterEncoding" must end with the ';' delimiter.
解决办法:
<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message?useUnicode=true&characterEncoding=UTF-8"/>注意中间那个“&”,在xml中是读不出的,正确写法是将“&”写成转义形式“&”:
<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message?useUnicode=true&characterEncoding=UTF-8"/>