openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans J. Prueller" <hans.pruel...@gmx.net>
Subject AW: AW: Using @GeneratedValue for IDs on already existing tables
Date Tue, 13 Feb 2007 18:03:27 GMT
Patrick,

> It would certainly be possible to implement such a thing in OpenJPA, but
> there is no such feature in place currently.

perhaps this would be a nice feature for the future - if I'll find another
working solution that avoids the case of generating an already existing PK
I don't need it.

> If you're decommissioning the old system, one easy way to make things work
> would be to use a hi-lo table with per-class entries (the class-table
> alias), and then manually configure the start value in the table (using
> the main() method in the org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq)
> to be the highest existing PK value for each table.

this sounds good - thank you for the tip.

regards,
HANS

> -----Urspr√ľngliche Nachricht-----
> Von: Patrick Linskey [mailto:plinskey@bea.com]
> Gesendet: Dienstag, 13. Februar 2007 18:13
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: AW: Using @GeneratedValue for IDs on already existing tables
> 
> > I can remember a legacy persistence framework that was able to retry
> > the insert statement with a "second-try generated PK" just
> > for the case
> > the currently generated one has already been inserted by
> > another process.
> 
> It would certainly be possible to implement such a thing in OpenJPA, but
> there is no such feature in place currently.
> 
> If you're decommissioning the old system, one easy way to make things work
> would be to use a hi-lo table with per-class entries (the class-table
> alias), and then manually configure the start value in the table (using
> the main() method in the org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq)
> to be the highest existing PK value for each table.
> 
> -Patrick
> 
> --
> Patrick Linskey
> BEA Systems, Inc.
> 
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> 
> > -----Original Message-----
> > From: Hans J. Prueller [mailto:hans.prueller@gmx.net]
> > Sent: Tuesday, February 13, 2007 9:01 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: AW: AW: Using @GeneratedValue for IDs on already
> > existing tables
> >
> > thanks for this link but this section only describes the different
> > algorithms that are provided to get the generated value - it does
> > not mention the case what happens if we try to save a new persistent
> > entity with a generated PK value that already exists in the DB?
> >
> > I can remember a legacy persistence framework that was able to retry
> > the insert statement with a "second-try generated PK" just
> > for the case
> > the currently generated one has already been inserted by
> > another process.
> >
> > does nobody else have a similar requirement?
> >
> > hans
> >
> > > -----Urspr√ľngliche Nachricht-----
> > > Von: Abe White [mailto:awhite@bea.com]
> > > Gesendet: Dienstag, 13. Februar 2007 17:35
> > > An: open-jpa-dev@incubator.apache.org
> > > Betreff: Re: AW: Using @GeneratedValue for IDs on already
> > existing tables
> > >
> > > > does openJPA provide the strategy to re-generate another value for
> > > > the PK
> > > > or do we have to manually deal with this case?
> > >
> > > http://incubator.apache.org/openjpa/docs/latest/manual/
> > > manual.html#ref_guide_sequence
> > >
> > ______________________________________________________________
> > _________
> > > Notice:  This email message, together with any attachments,
> > may contain
> > > information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >  affiliated
> > > entities,  that may be confidential,  proprietary,
> > copyrighted  and/or
> > > legally privileged, and is intended solely for the use of
> > the individual
> > > or entity named in this message. If you are not the
> > intended recipient,
> > > and have received this message in error, please immediately
> > return this
> > > by email and then delete it.
> >
> >


Mime
View raw message