hibernate 4 中many-to-one 保存问题 20
在Content.hbm.xml中间建立关联:<many-to-onename="author"cascade="all"class="com.YoungMay.bean...
在Content.hbm.xml 中间建立关联:
<many-to-one name="author" cascade="all" class="com.YoungMay.bean.User" column="authorId" lazy="false"/>
新建一个Content实例,完成赋值,保存的时候出错:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read, repost, lastRepost, good, bed, visuable, ifPublic, parent, ifRepost) value' at line 1
hibernate提示:
Hibernate: insert into mydb.tbcontent (title, ctext, datetime, contentType, contentBoard, authorId, read, repost, lastRepost, good, bed, visuable, ifPublic, parent, ifRepost) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
看样子是authorId字段出问题。请帮忙看看
tbcontent:
tbuser:
已经解决了。
不是关联的那一列有问题,是后面一列有问题。
列名不能为“read” 展开
<many-to-one name="author" cascade="all" class="com.YoungMay.bean.User" column="authorId" lazy="false"/>
新建一个Content实例,完成赋值,保存的时候出错:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read, repost, lastRepost, good, bed, visuable, ifPublic, parent, ifRepost) value' at line 1
hibernate提示:
Hibernate: insert into mydb.tbcontent (title, ctext, datetime, contentType, contentBoard, authorId, read, repost, lastRepost, good, bed, visuable, ifPublic, parent, ifRepost) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
看样子是authorId字段出问题。请帮忙看看
tbcontent:
tbuser:
已经解决了。
不是关联的那一列有问题,是后面一列有问题。
列名不能为“read” 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询