我有以下實體時,我堅持我進行轉儲, 我移動到字段字符串值(這是如何模型定義有ID值字符串與值如度假,WORK_ACCIDENT ......所以我不能改變它),誤差ID類型字符串錯誤的實體
類型INTEGER無效的字符串格式。
@Entity
public class LeaveReType {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private String id;
具有ID字符串類型另一個實體,我當我移動到該數持久性 工作正常,我可以使用一些ID註釋忽略此限制嗎?
Exception in thread "main" javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLDataException: Invalid character string format for type INTEGER.
Error Code: 20000
Call: INSERT INTO LESTTYPE (ID, AVAILABLEBALANCE, ENTITLEMENT, NAME, PENDINGITEMS) VALUES (?, ?, ?, ?, ?)
bind => [5 parameters bound]
Query: InsertObjectQuery(LESTTYPE [id=WORK_ACCIDENT, name=Work Accident, entitlement=n/a, availableBalance=n/a, pendingItems=0 pending items])
我也試圖與我得到同樣的錯誤
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@TypeConverter(dataType = Long.class, name = "id")
private String id;
http://stackoverflow.com/questions/4930762/generate-an-auto-generated-value-of-a-field-under-java-hibernate-id-generated – BobTheBuilder 2013-03-19 09:29:37
@ baraky-我試着添加註釋@Column(columnDefinition =「ID1」,name =「id」)和錯誤是一樣的... – 2013-03-19 09:39:02
你試過http://stackoverflow.com/a/8090756/1651233 – BobTheBuilder 2013-03-19 09:43:57