Note that there are some explanatory texts on larger screens.

plurals
  1. POduplicate key error in entitymanager with correct object to persist
    primarykey
    data
    text
    <p>I have the following entity TitleScreenFormat and when i do <code>entitymanager.commit</code> I getting the following error </p> <pre><code>Internal Exception: java.sql.SQLIntegrityConstraintViolationException: 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 'SQL130418144233630' defined on 'S1_TITLESCREENFORMAT'. Error Code: 20000 Call: INSERT INTO s1_TitleScreenFormat (titlescreenformat_titleid, titlescreenformat_format, titlescreenformat_deliveryformat, TITLE_title_id) VALUES (?, ?, ?, ?) bind =&gt; [TitleId1, Format1, DeliveryFormat1, null] </code></pre> <p>This is the entity with the keys</p> <pre><code>@Entity @Table(name = "s1_TitleScreenFormat") public class TitleScreenFormat { @Id @Column(name = "titlescreenformat_titleid", length = 128) private String TitleId; @Id @Column(name = "titlescreenformat_deliveryformat", length = 128) private String DeliveryFormat; @Id @Column(name = "titlescreenformat_format", length = 128) private String Format; private Title Title; </code></pre> <p>And this is the instance of the object which i have want to persist</p> <pre><code>[0] TitleScreenFormat (id=81) DeliveryFormat "DeliveryFormat1" (id=87) Format "Format1" (id=88) Title null TitleId "TitleId1" (id=89) [1] TitleScreenFormat (id=83) DeliveryFormat "DeliveryFormat2" (id=90) Format "Format2" (id=91) Title null TitleId "TitleId2" (id=92) [2] TitleScreenFormat (id=84) DeliveryFormat "DeliveryFormat3" (id=93) Format "Format3" (id=94) Title null TitleId "TitleId3" (id=95) [3] TitleScreenFormat (id=85) DeliveryFormat "DeliveryFormat4" (id=96) Format "Format4" (id=97) Title null TitleId "TitleId4" (id=98) [4] TitleScreenFormat (id=86) DeliveryFormat "DeliveryFormat5" (id=99) Format "Format5" (id=100) Title null TitleId "TitleId5" (id=101) </code></pre> <p>in the persistence.xml file i use the following configuration </p> <pre><code>&lt;property name="eclipselink.ddl-generation" value="drop-and-create-tables" /&gt; </code></pre> <p>And Im using Derby DB.</p> <p>What could be the reason for this error?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload