Note that there are some explanatory texts on larger screens.

plurals
  1. POJPA Eclipselink getting wrong sequence number
    primarykey
    data
    text
    <p>I'm using some Entities mapped to Oracle DB-Tables. For ID-Generation I'm using a sequence generator annotated as following:</p> <pre><code>@Id @SequenceGenerator(name = "SEQ_RULES", sequenceName = "SEQUENZ_RULES") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_RULES") @Column(name = "SERIALNO") protected Long serialno; </code></pre> <p>During programm execution I make a new Instance from my Entity and want to persist this generated one. After restart of the database I'm getting wrong sequence numbers through JPA-EclipseLink, but not through the Console directly on the database.</p> <p>I turned on following properties in the persistence.xml toget also the binding parameters used in the generated statements.</p> <pre><code>&lt;properties&gt; &lt;property name="eclipselink.logging.level" value="FINE"/&gt; &lt;property name="eclipselink.logging.parameters" value="true"/&gt; &lt;/properties&gt; </code></pre> <p>For example: If I generate a new instance of my entity and want to persist this one I get 2717 for serialNo and if I execute</p> <pre><code>SELECT SEQUENZ_RULES.NEXTVAL FROM DUAL </code></pre> <p>I get 2767 as nextval. The problem is that the JPA-generated serialNo must be unique, and now I stil have some datasets with this serialNo. Im getting an exception:</p> <pre><code>java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (JASON.SYS_C0084866) violated </code></pre> <p>Non Is there any caching through eclipse which is affecting the Sequence Generation or what could be the error for this?</p> <p><em>Used Components:<br> GlassFish 3.1.1<br> EclipseLink 2.3.0.v20110604-r9504<br> Database: Oracle Version: Oracle Database 11g Release 11.1.0.7.0 - 64bit<br> Driver: Oracle JDBC driver Version: 11.2.0.1.0</em></p> <p><strong>Thanks in advance</strong></p> <p><em>Adem</em></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