I tried adding new class to my application. Everything was fine, until I added Boolean read
. When I add it to my class, I get:
We got the following error: 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 tinyint(1) default 0, constraint ck_event_type check (' at line 7 [ERROR:1064, SQLSTATE:42000], while trying to run this SQL script:
and the important part of the script:
create table event (
id bigint auto_increment not null,
type varchar(14) not null,
user_id bigint,
message varchar(255) not null,
date date,
read tinyint(1) default 0,
constraint ck_event_type check (type in ('game_started','game_completed','wrong_answer','correct_answer','wrong_location')),
constraint pk_event primary key (id))
I have no idea what's the problem. I have Boolean declared in other class and there is no problem. I'm using play 2.2.1
My class:
package models;
import java.sql.Date;
import java.util.*;
import javax.persistence.*;
import play.db.ebean.*;
import com.avaje.ebean.*;
import play.data.validation.Constraints.*;
@Entity
public class Event extends Model{
@Id
public Long id;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
public EVENT_TYPE type;
@ManyToOne
public User user;
@Column
public Date date;
@Column(nullable = false)
public String message;
@Column
public Boolean read;
public Event(User user, String message, EVENT_TYPE type, Date date) {
//this.user = user;
//this.message = message;
//this.type = type;
//this.date = date;
//read = false;
}
}