Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate中的布尔映射问题+;MySQL_Mysql_Hibernate_Spring Mvc_Hibernate Mapping - Fatal编程技术网

Hibernate中的布尔映射问题+;MySQL

Hibernate中的布尔映射问题+;MySQL,mysql,hibernate,spring-mvc,hibernate-mapping,Mysql,Hibernate,Spring Mvc,Hibernate Mapping,我知道关于这件事有很多话题,但我还是无法解决我的问题 这是实体类: @Entity @Table(name = "messages") public class Message { .... @Column(name = "read", nullable = false, columnDefinition = "TINYINT(1)") private boolean read; .... public boolean isRead() { return read; } public

我知道关于这件事有很多话题,但我还是无法解决我的问题

这是实体类:

@Entity
@Table(name = "messages")
public class Message
{
....
@Column(name = "read", nullable = false, columnDefinition = "TINYINT(1)")
private boolean read;
....
public boolean isRead()
{
    return read;
}

public void setRead(boolean read)
{
this.read = read;
}
messages
MySQL表中,
read
列被键入为
tinyint(1)
。在将对象保存到表之前,我设置
setRead(true)
。当我通过Hibernate(
save()
)保存对象时,出现以下错误:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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, senderId, title) values ('ujhjg', 1, 1, 'W pustyni i w puszczy')'
我使用
jdbc.dialent=org.hibernate.dialent.mysql5innodbdialent
并尝试了几种方法通过更改布尔字段的注释来解决我的问题,但都不起作用

我的映射出了什么问题,以及如何使其工作


感谢您的帮助和宝贵时间;)

单词
read
是MySQLs保留的关键字之一。检查一下桌子。用另一个名字来避免这种情况。

我的问题答案越简单,我就越觉得自己愚蠢:看起来你为我节省了很多时间和压力。干杯