openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Urgent solution EJB3.0 with OpenJPA
Date Tue, 21 Dec 2010 17:35:18 GMT
Hi Rajesh,
Sure, OpenJPA supports this join table approach for one-to-many mappings.
OpenJPA 2.0.x also supports the ability to use foreign keys for a
unidirectional one-to-many mapping.  You just need to tell us what the join
column should be (vs the join table).  The latter might be a cleaner
approach -- just to avoid the extra join tables.

If you want OpenJPA to create the necessary join tables, just use the
following property in your persistence.xml:

            <property name="openjpa.jdbc.SynchronizeMappings"
                value="buildSchema(ForeignKeys=true)"/>

If you want to use the existing tables as created by TopLink, then you'll
probably have to use the @AssociationOverride to match up the table and
column names.

Everything you are trying to do should be doable with WAS and OpenJPA.  Are
you hitting a specific concern or just asking questions before attempting?

Thanks,
Kevin

On Tue, Dec 21, 2010 at 5:06 AM, Rajesh Yarlagadda <
yarlagaddarajeshbabu@hotmail.com> wrote:

>
> Hi ,
>
> i am working on EJB3.0 with Toplink for container managed transactions on
> Glassfish server.
>
> i'm moving to WAS7 with Apache OpenJPA.
>
> i have a problem in this scenario:
>
> i have two entities TableA.java(TableA in database) and TableB.java(TableB
> in database) with unidirectional one-to-many from TableA(one) to
> TableB(many).
>
> While persisting the TableA, toplink orm creates another JOIN table for
> one-to-many mapping with name " TableA_TableB" table with TableA primary
> key
> as foriegn and TableB primary key as foriegn and both act as composite
> primary key mantains one-to-many mappings.
>
> Is there any such kind on mechanism implemented by OpenJPA EJB3.0 container
> managed one-to-many mappings to create or identify existed the JOIN Table?
>
> Thanks,
> Rajesh Yarlagadda
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Urgent-solution-EJB3-0-with-OpenJPA-tp5855389p5855389.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>

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