I'm trying to include an enum field to my entity using @Enumerated, Here is my code :
@Entity
public class Frequency extends AbstractModel {
@Column(nullable = true)
@Enumerated(EnumType.STRING)
protected DayOfWeek dayOfWeek;
@Enumerated(EnumType.STRING)
protected IntervalEnum interval;
}
But when building my project, I get the error :
Caused by: 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 'interval varchar(255), primary key (id)) engine=MyISAM' at line 1
It's the enum which is responsible of the error, but why ?
public enum IntervalEnum {
D,
W,
M;
}
I'm using Hibernate 5.2.16 + MySQL 5.7 + Spring boot 1.5.12
Thank you