org.hibernate.MappingException:无法确定:org.json.JSONArray的类型,在table:book,for columns:[org.hibernate.mapping.Column(people)]

时间:2018-01-20 07:01:49

标签: mysql hibernate spring-boot

我正在使用mysql,jpa开发一个spring boot库应用程序。数据库表由以下列组成:bookName,author,copiesTotal,copiesAvailable,people。问题出在JSONObject列“people”上。我想使用“人物”栏来存储借阅某本书的人的详细信息。

“people”栏目例如:{“john”:“9876543210”,“mark”:“0123456789”}

我想使用任何注释或代码中是否有错误?

这是我的代码。

Book.java

Caused by: org.hibernate.MappingException: Could not determine type for: org.json.JSONObject, at table: book, for columns: [org.hibernate.mapping.Column(people)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:431) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:398) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.mapping.Property.isValid(Property.java:225) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:595) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.mapping.RootClass.validate(RootClass.java:265) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:443) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
... 23 common frames omitted

CONSOLE:

<h2>Los ingredientes</h2>
<ul>
    <li>500 g de queso feta</li>
    <li>½ cucharadita de pimienta negra</li>
    <li>1 cucharadita de pimienta rosada</li>
    <li>3 ramas pequeñas de romero</li>
    <li>aceite de oliva </li>
</ul>

<h2>La preparación</h2>
<p>Corta el queso feta en dados y déjalos reposar sobre papel absorbente.</p>

0 个答案:

没有答案