java不能持久存在实体,可能是由于布尔字段

use*_*est 0 java mysql jpa

我正在尝试保留该实体,声明

@Entity
@Table(schema="app")
public class Remainder {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private int amount;
private String description;
private boolean repeat;
@ManyToOne
@JoinColumn(name="CATEGORY")
private Category category;

@Column(name="DUE_DATE")
private LocalDate dueDate;
Run Code Online (Sandbox Code Playgroud)

我使用EntityManager的persist()方法。我得到这个例外:

[EL Warning]: 2015-08-30 11:14:56.341--UnitOfWork(1824877389)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: 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 'REPEAT, CATEGORY) VALUES (35, 'qeqdfqd', '2015-08-31', 0, 'Electricity')' at line 1
Error Code: 1064
Call: INSERT INTO app.REMAINDER (AMOUNT, DESCRIPTION, DUE_DATE, REPEAT, CATEGORY) VALUES (?, ?, ?, ?, ?)
bind => [5 parameters bound]
Query: InsertObjectQuery(lite.money.entities.Remainder@326db21e)
Exception in thread "JavaFX Application Thread" javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: 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 'REPEAT, CATEGORY) VALUES (35, 'qeqdfqd', '2015-08-31', 0, 'Electricity')' at line 1
Error Code: 1064
Call: INSERT INTO app.REMAINDER (AMOUNT, DESCRIPTION, DUE_DATE, REPEAT, CATEGORY) VALUES (?, ?, ?, ?, ?)
bind => [5 parameters bound]
Run Code Online (Sandbox Code Playgroud)

这是表声明

CREATE TABLE `remainder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `amount` int(11) NOT NULL,
  `description` varchar(100) NOT NULL,
  `repeat` bit(1) DEFAULT NULL,
  `category` varchar(100) NOT NULL,
  `DUE_DATE` varchar(45) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_REMAINDER-Category_CATEGORY_SUB-ID_idx` (`category`),
  CONSTRAINT `FK_REMAINDER-Category_CATEGORY_SUB-ID` FOREIGN KEY (`category`) REFERENCES `category` (`SUB_CATEGORY`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)

我认为问题出在布尔字段,请帮助

use*_*est 5

我通过将列REPEAT重命名为重复来修复它,因为REPEAT是mysql中的保留工作。