I haven't found examples of @ElementForeignKey, but there are a few OpenJPA
testcases that use the @ForeignKey annotation :

http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/DetachmentOneManyChild.java?view=markup
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/EntityA.java?view=markup
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/EntityB.java?view=markup

Hopefully they give you a starting point.

-Mike

On Nov 14, 2007 2:28 PM, Tyler Coles <[EMAIL PROTECTED]> wrote:

> The documentation that I'm looking at appears to be very sparse for
> @ForeignKey and @ElementForeignKey.  Can someone provide an example of
> how these are to be used in practice?
>
> Thanks!
>
> Tyler
>
>
>
> On Nov 14, 2007 7:10 AM, Christian Defoy <[EMAIL PROTECTED]>
> wrote:
> > It could be because OpenJPA does not know about your foreign keys...
> > You have to tell OpenJPA that there is a foreign key using the
> > @ForeignKey annotation or instruct OpenJPA to detect the foreign keys
> > by inspecting your schema.  To do this, you have to specify the
> > following property in your persistence.xml:
> >
> > <property name="openjpa.jdbc.SchemaFactory"
> value="native(ForeignKeys=true)" />
> >
> > Hope this helps!
> >
> > Christian
> >
>

Reply via email to