hibernate.cfg.xml或JPA persistence.xml中must end with the ';' delimiter问题

来源:互联网 发布:韩磊花房姑娘知乎 编辑:程序博客网 时间:2024/06/04 00:55

Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

JPA persistence xml (hibernate.cfg.xml)中报错的写法:

<property name="hibernate.connection.url" value="jdbc:MySQL://localhost:3306/test?useUnicode=true&characterEncoding=utf-8" />

正确的写法:

<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf-8" />

在xml文件中有以下几类字符要进行转义替换:

&lt;

<

小于号

&gt;

>

大于号

&amp;

&

&apos;

'

单引号

&quot;

"

双引号

0 0
原创粉丝点击