我将 eclipseLink 与 derby DB 一起使用,当我使用 commit( entityManager.getTransaction().commit();
) 时遇到以下错误,该字段是在日期为 java util 的实体中定义的。这里有什么问题?
输入数据的代码是:
Date date = new Date();
SimpleDateFormat parsedDate = new SimpleDateFormat("yyyy-mm-dd");
date = parsedDate.parse((String) memberValue);
成员值包含具有以下值的日期
"from": "2012-12-03"
"to": "2012-12-03"
实体如下
@Entity
@Table(name = "f1_LeaveRequest")
public class LeaveRequest {
@Id
@Column(name = "leaverequest_id")
private String id;
private String type;
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date from;
@Temporal(TemporalType.TIMESTAMP)
错误是:
Exception in thread "main" javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "FROM" at line 1, column 47.
Error Code: 20000
Call: INSERT INTO f1_LeaveRequest (leaverequest_id, FROM, LENGTH, STATE, TO, TYPE) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]