Folks,

I opened an issue on this back in August of last year (
https://issues.apache.org/jira/browse/OPENJPA-2419), and implemented a
patch that uses SAVEPOINTS that worked for my previous job.

The patch is on my openjpa fork on Github, here:
https://github.com/sgp/openjpa/commits/OPENJPA-2419.

The more I've thought about the design of the way that OpenJPA allocates
sequences, the less happy I am with it. No ORM should require modifying
sequence increments.  If one must cache sequence values, it's better to
call nextval repeatedly than to muck with the sequences themselves.

Or, one could use @GeneratedValue(strategy=GenerationType.IDENTITY) and not
have OpenJPA bother to do anything. :)

--sgp


On Thu, Jan 30, 2014 at 10:03 AM, Kevin Sutter <kwsut...@gmail.com> wrote:

> Hi,
> It looks like you are experiencing the issue documented in
> https://issues.apache.org/jira/browse/OPENJPA-2196.  But, according to the
> commits on that JIRA and the level of OpenJPA you are running with (2.2.2),
> you should already have that fix...  And, according to your comment above,
> you are receiving the warning message mentioned in the JIRA...  It sounds
> like your scenario is causing a slightly different path to be followed and
> OpenJPA doesn't properly "recover" from this failing Alter Sequence
> command...
>
> I would suggest opening a child or related JIRA to 2196, referencing this
> discussion as background.
>
> Kevin
>
>
> On Wed, Jan 29, 2014 at 11:54 AM, Anja <anja.limb...@it.nrw.de> wrote:
>
> > From what I understand I don't see a connection with OPENJPA-2069.
> >
> > The application works fine if the db user is the sequence owner.
> >
> > The exception only arises if the db user is not allowed to alter the
> > sequence and thus the ALTER SEQUENCE statement fails.
> > I had looked at this issue which might be related:
> > https://issues.apache.org/jira/browse/OPENJPA-2196
> > <https://issues.apache.org/jira/browse/OPENJPA-2196>
> > The ALTER SEQUENCE statement fails and I get the warning mentioned in
> that
> > discussion:
> >
> >
> https://issues.apache.org/jira/browse/OPENJPA-2196?focusedCommentId=13409478&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13409478
> > <
> >
> https://issues.apache.org/jira/browse/OPENJPA-2196?focusedCommentId=13409478&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13409478
> > >
> >
> > But still Postgres doesn't seem to accept any more statements within the
> > same transaction after the ALTER SEQUENCE statement and an exception is
> > thrown at the following db statement.
> >
> > If ALTER SEQUENCE is avoided, the application also works fine.
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://openjpa.208410.n2.nabble.com/Using-PostgreSQL-sequences-with-db-user-restrictions-tp7585893p7585895.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >
>

Reply via email to