2013-04-06 70 views
1

假設我有以下table,由Eclipselink生成。結合Derby:批量導入未設置AUTO_INCREMENT

1,"admin_","[email protected]" 
2,"user_","[email protected]" 
3,"user_","[email protected]" 

進口是成功的,使用從ij toolApacheSYSCS_UTIL.SYCS_IMPORT_TABLE()

CREATE TABLE "ACCOUNT" ("ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "DTYPE" VARCHAR(31), "EMAIL" VARCHAR(255)); 

接下來,我將導入散裝從一個文件,含有。

接下來我將通過JPA2創建一個用戶。這導致:

Caused by: org.apache.derby.client.am.SqlException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL130406103359120' defined on 'ACCOUNT'. 

沒有運行導入我可以創建一個用戶就好了。在我看來,導入不考慮表中指定的AUTO_INCREMENT函數。我不應該使用ALTER TABLE ACCOUNT AUTO_INCREMENT = 4;更新AUTO_INCREMENT4,我應該嗎?

回答