I know there are plenty of topics on this matter, but still, I couldn't solve my problem.
This is entity class:
@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;
}
In messages MySQL table, read column is typed as tinyint(1). Before saving object to table I set setRead(true). When I'm saving object through Hibernate (save()) I get following error:
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')'
I use jdbc.dialect=org.hibernate.dialect.MySQL5InnoDBDialect and tried few ways to solve my problem by changing annotations for boolean field, but none of them worked.
What's wrong with my mapping and how I can make it work?
Thanks for any help and your time ;)