openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin <>
Subject Re: Problem using OpenJPAEntityManager#createInstance
Date Thu, 13 Nov 2008 17:10:20 GMT

Hi Pinaki,

Thanks for the suggestion! It was very helpful. 

Before moving on to the next issue, can you confirm that all the manual
repository calls I am making is the right way to go?

I am now running into a different issue.

I am using DB-driven primary key allocation (@Id

When I persisted my first instance, there was no problem. When I try to
persist my second (and third, and fourth...) I get the following error:

Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.util.InvalidStateException: Attempt to set column
"" to two different values: (class java.lang.Long)"0",
(class java.lang.Long)"301" This can occur when you fail to set both sides
of a two-sided relation between objects, or when you map different fields to
the same column, but you do not keep the values of these fields in synch.

Needless to say I am not setting the ID by hand. A quick debugging session
shows that OpenJPA tries to populate the ID with 0 first, then with the
generated ID and trips itself up.

Any idea if I am doing something wrong, or how to get past this? It appears
that not generating the ID and setting it by hand doesn't work either.


Pinaki Poddar wrote:
> Hi,
>   Looks like a potential bug. The problem seems to be that OpenJPA is not
> creating the OPENJPA_SEQUENCE_TABLE (a special table used by OpenJPA to
> auto-generate primary key) for Managed Interfaces.
>   Try creating the OPENJPA_SEQUENCE_TABLE separately. The instructions to
> create this table is available in main() method's JavaDoc in [1]
> [1]

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message