openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ioan Domsa <>
Subject Sequencer
Date Wed, 08 Nov 2017 22:20:33 GMT

I am using OPENJPA 2.4.2  (in Eclipse RCP) with Postgresql 10and I have the
following entity:
*@Table(name = "bom")*
*public class Bom {*

* @Id*
* @SequenceGenerator(name = "testing", sequenceName = "test1",
allocationSize = 1)*
* @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
* private long id;*


When I create a new entity and

I get
the InvalidStateException(_loc2.get("existing-value-override-excep",..)
from Util.ApplicationIds, because the line
 *  if (!sm.isDefaultValue(pks[i].getIndex()))*
does not check if the value which is not the default one is the one
generated using the sequencer.
This happens because it passes 2 times in the same code when em.Flush() is
called. Once it gets the generated value using the sequencer and assigns it
*  // Assign the generated value*
*                if (store.assignField(sm, pks[i].getIndex(), preFlush))*
*                    pks[i].setValueGenerated(true); *
then it comes the second time through* private static boolean
assign(OpenJPAStateManager sm, StoreManager store,*
*        FieldMetaData[] pks, boolean preFlush) *and rechecks if it is a
default value.

Is this a bug ? Or am I missing something ?

Best regards,

Ioan Domsa

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message