You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by paksegu <pa...@yahoo.com> on 2007/09/02 08:22:43 UTC
Persisting multiple tables at once
Hi,
How do I use the Entity Manager to persist multiple related tables at once in a web application to maintain referential integrity?
Thanks
Ransford Segu-Baffoe
paksegu@yahoo.com
https://serenade.dev.java.net/
http://www.noqturnalmediasystems.com/
---------------------------------
Got a little couch potato?
Check out fun summer activities for kids.
Re: Persisting multiple tables at once
Posted by Patrick Linskey <pl...@gmail.com>.
You must either set that, or set the 'persistence-unit-defaults'
setting appropriately in orm.xml to turn on cascade-persist by
default.
In 100% of the use cases that I've seen, you want cascade-persist on
by default. So generally-speaking, you should always have an orm.xml
file that has that entry in it.
-Patrick
On 9/4/07, Marina Vatkina <Ma...@sun.com> wrote:
> Don't you also need to mark relationships as cascade=PERSIST or cascade=ALL? Or
> will OpenJPA persist related objects irrelevantly of the setting?
>
> thanks,
> -marina
>
> Gene Wu wrote:
> > The only think you will do is, entityManager.persist(master object).
> > The master object has the relationship with multiple related tables(object). OpenJPA will take care of the rest tasks.
> >
> >
> > Gene
> >
> >
> >
> >
> >>Date: Sat, 1 Sep 2007 23:22:43 -0700> From: paksegu@yahoo.com> Subject: Persisting multiple tables at once> To: users@openjpa.apache.org> > Hi,> How do I use the Entity Manager to persist multiple related tables at once in a web application to maintain referential integrity?> Thanks> > > Ransford Segu-Baffoe> > paksegu@yahoo.com> > https://serenade.dev.java.net/> http://www.noqturnalmediasystems.com/> > ---------------------------------> Got a little couch potato? > Check out fun summer activities for kids.
> >
> > _________________________________________________________________
> > Connect to the next generation of MSN Messenger
> > http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
> >
>
>
--
Patrick Linskey
202 669 5907
Re: Persisting multiple tables at once
Posted by Marina Vatkina <Ma...@Sun.COM>.
Don't you also need to mark relationships as cascade=PERSIST or cascade=ALL? Or
will OpenJPA persist related objects irrelevantly of the setting?
thanks,
-marina
Gene Wu wrote:
> The only think you will do is, entityManager.persist(master object).
> The master object has the relationship with multiple related tables(object). OpenJPA will take care of the rest tasks.
>
>
> Gene
>
>
>
>
>>Date: Sat, 1 Sep 2007 23:22:43 -0700> From: paksegu@yahoo.com> Subject: Persisting multiple tables at once> To: users@openjpa.apache.org> > Hi,> How do I use the Entity Manager to persist multiple related tables at once in a web application to maintain referential integrity?> Thanks> > > Ransford Segu-Baffoe> > paksegu@yahoo.com> > https://serenade.dev.java.net/> http://www.noqturnalmediasystems.com/> > ---------------------------------> Got a little couch potato? > Check out fun summer activities for kids.
>
> _________________________________________________________________
> Connect to the next generation of MSN Messenger
> http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
>
RE: Persisting multiple tables at once
Posted by Gene Wu <ge...@hotmail.com>.
The only think you will do is, entityManager.persist(master object).
The master object has the relationship with multiple related tables(object). OpenJPA will take care of the rest tasks.
Gene
> Date: Sat, 1 Sep 2007 23:22:43 -0700> From: paksegu@yahoo.com> Subject: Persisting multiple tables at once> To: users@openjpa.apache.org> > Hi,> How do I use the Entity Manager to persist multiple related tables at once in a web application to maintain referential integrity?> Thanks> > > Ransford Segu-Baffoe> > paksegu@yahoo.com> > https://serenade.dev.java.net/> http://www.noqturnalmediasystems.com/> > ---------------------------------> Got a little couch potato? > Check out fun summer activities for kids.
_________________________________________________________________
Connect to the next generation of MSN Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline