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: Using @GeneratedValue for IDs on already existing tables
Date Tue, 13 Feb 2007 16:30:19 GMT
Patrick,

thank you for your reply. The generation algorithm we are using currently
is provided from our EJB2.1 CMP container and is a blackbox for us. 

As we are not very happy with the current solution we are
planning/evaluating the migration of the whole EJB2.1 persistence layer to
OpenJPA/JPA. 

What I tried to find out is what happens if we map the new OpenJPA
persistent POJO onto the already existing and populated table (we did that
already, querying works fine) and the add new instances (db rows) using
the JPA @generatedvalue annotation:

a) if the openjpa generated PK value is unique everything will work fine,
but
b) what if the openjpa generated PK value already exists???

does openJPA provide the strategy to re-generate another value for the PK
or do we have to manually deal with this case? 

HANS

> -----Urspr√ľngliche Nachricht-----
> Von: Patrick Linskey [mailto:plinskey@bea.com]
> Gesendet: Dienstag, 13. Februar 2007 06:52
> An: open-jpa-dev@incubator.apache.org
> Betreff: RE: Using @GeneratedValue for IDs on already existing tables
> 
> How do you currently generate your values? If you use some sort of
> database-side logic (sequence, auto-assigned columns, hi-lo table), it
> should be trivial for Kodo to interoperate. If you're using some sort of
> fancy in-process algorithm, it may be more difficult, but is certainly
> doable.
> 
> -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: Saturday, February 10, 2007 9:24 AM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: Using @GeneratedValue for IDs on already existing tables
> >
> > As some of you may remember, I am using OpenJPA within an
> > "old" Java2EE
> > 1.4/EJB2.1 container to perform
> >
> > a step-by-step or bean-by-bean migration from our EJB2.1 CMP
> > entity beans to
> > new EJB3 Beans with JPA.
> >
> >
> >
> > For the IDs of the Entity Beans we have been using a
> > Container-Generated-Value and I plan to continue doing
> >
> > so by using the JPA's @GeneratedValue stuff.
> >
> >
> >
> > Are there any special issues to consider when using the new
> > openJPA based
> > entities with generated values
> >
> > on already existing data? In special I mean conflicts of
> > between openJPA
> > generated IDs with existing IDs in
> >
> > the underlying table?
> >
> >
> >
> > Hans
> >
> >


Mime
View raw message