On Mon, Jan 4, 2010 at 12:28 PM, Pinaki Poddar <[email protected]> wrote:

>
> Hi Daryl,
>  What is the strategy used to generate primary key values for model.Foo and
> model.Bar?
>
>
All the PK's are assigned using:

@GeneratedValue(strategy = GenerationType.IDENTITY)
except in one unrelated case where the sequence name is too long
(truncated). (I'm using PostgreSQL.)


 And how the primary key values were assigned to the offending instances?



I'm not quite sure how to answer your question. The instance was created and
persisted, not by the user in the web application, but by a SOAP interface /
scheduled process. So the PK was assigned by the database in an earlier
transaction. I believe the error condition reported is misleading. It's not
that we have a new instance with an ID pre-assigned, but rather we have a
preexisting (detached or managed) entity that now appears to be new.


I'm on OpenJPA 1.2.1.


--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to