openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject Re: Bug when persisting two related objects
Date Fri, 11 May 2007 16:14:01 GMT
Hi Majeed,

create=true tells Derby to create the database itself. If you want the
tables to be generated you can use the OpenJPA MappingTool, or the
jdbc.SynchronizeMappings configuration property.

More information can be found in the OpenJPA manual at :
http://incubator.apache.org/openjpa/docs/openjpa-0.9.7-incubating/manual/manual.html#ref_guide_mapping

Regards,
Michael Dick

On 5/11/07, Majeed Arni <marni@sbcglobal.net> wrote:
>
>
> The DDL is handmade. There is nothing in code about Identity. It is done
> in
> Database.
>
> I found a workaround for this problem by just moving the code around.
> Looks
> like a bug is the wrong message it sends.
>
> Also, is there a way to generate DDL from Java code? I saw "create=true"
> for
> Derby, does that work for DB2 also? Thanks again.
>
> Majeed
>
>
>
> Kevin Sutter wrote:
> >
> > I don't think it matters whether you are using DB2 or any other
> database.
> > Getting back to one of Patrick's earlier requests...  Can you post more
> > information on the Project and Base classes?  You've posted a snippet of
> > the
> > Base class and it's ID, but how are you defining the Project and it's
> ID?
> > As Abe as pointed out, if two classes in an inheritance hierarchy use
> the
> > same ID class, then unique id values need to be provided for each
> > instance.
> > Could you also post your DDL for generating your tables?  Was this
> > hand-generated DDL or created by the OpenJPA tooling?  Thanks.
> >
> > Kevin
> >
> > On 5/10/07, Majeed Arni <marni@sbcglobal.net> wrote:
> >>
> >>
> >> I am using DB2 to generate the Identity as in the DDL:
> >> ID BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1,
> >> INCREMENT
> >> BY 1)
> >>
> >> And in code for the base class:
> >> @MappedSuperclass
> >> @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
> >> public abstract class Base {
> >> .....
> >>         @Id
> >>         @GeneratedValue(strategy = GenerationType.IDENTITY)
> >>         @Column(name = "ID")
> >>         private long someID;
> >>
> >> .....}
> >>
> >> Will this not use a unique ID generator per derived class? Is there a
> >> better
> >> way of doing it in DB2? Thanks for the help.
> >>
> >> Majeed Arni
> >>
> >>
> >>
> >> Abe White wrote:
> >> >
> >> > Are the two types related by inheritance?  If two classes in an
> >> > inheritance hierarchy use the same id class, then every instance of
> >> > both classes must have a distinct id value.  If you want instances in
> >> > inheritance-related classes to be able to have the same id values,
> >> > then you must use different id classes for different classes in the
> >> > inheritance hierarchy.
> >> >
> >> > 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.
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Bug-when-persisting-two-related-objects-tf3719319.html#a10416417
> >> Sent from the open-jpa-dev mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Bug-when-persisting-two-related-objects-tf3719319.html#a10432604
> Sent from the open-jpa-dev mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message