openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Enable cascade persist globally and pro grammatically
Date Mon, 16 Jun 2014 13:11:54 GMT
Hmm, I don't think there is an easy/elegant way to modify the cascade
behavior on the fly. I think with some work you could write some code where
if a field didn't have cascade set, we would just look at some default
setting... but that would take some hacking at OpenJPA.

Sorry I don't have a better answer for you.


On Sat, Jun 14, 2014 at 2:56 PM, Mansour Al Akeel <mansour.alakeel@gmail.com
> wrote:

> Yes, you are right. This is very hacky. But it even gets worse.
> I need to switch this temporary, and revert it back. So the Cascade All
> will take effect only to load the graph, and insert/update the date base
> from file.
> Then I need it back to the original configuration.
>
> I think I need to reconsider this approach. If you have any an advice
> please let me know.
>
>
>
>
> On Fri, Jun 13, 2014 at 4:43 PM, Rick Curtis <curtisr7@gmail.com> wrote:
>
> > > I am wondering if this can be done programmatically AND at runtime
> > (After the
> > entityManager is created).
> > Yes I'm sure it is possible to do programmatically. The problem you're
> > going to run into with changing this after the EntityManager is loaded is
> > that we will have already processed all of our metadata and the setting
> > will have already taken hold. It's possible to walk through the entire
> > metadata tree and reset this value for each relationship, but that would
> be
> > very hacky.
> >
> >
> > On Fri, Jun 13, 2014 at 3:14 PM, Mansour Al Akeel <
> > mansour.alakeel@gmail.com
> > > wrote:
> >
> > > Rick,
> > > Thank you a lot for your help.
> > > I am wondering if this can be done programmatically AND at runtime
> (After
> > > the entityManager is created).
> > >
> > > Thank you.
> > >
> > >
> > >
> > > On Fri, Jun 13, 2014 at 9:18 AM, Rick Curtis <curtisr7@gmail.com>
> wrote:
> > >
> > > > You can enable cascade persist globally via the jpa defined
> > > > persistence-unit-metadata defauls element in the orm.xml See the
> > snippet
> > > > below:
> > > >
> > > > <entity-mappings
> > > >   xmlns="http://java.sun.com/xml/ns/persistence/orm"
> > > >   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
> > > > orm_2_0.xsd"
> > > >   version="2.0">
> > > >     <persistence-unit-metadata>
> > > >         <persistence-unit-defaults>
> > > >             <cascade-persist/>
> > > >         </persistence-unit-defaults>
> > > >     </persistence-unit-metadata>
> > > > ...
> > > > </entity-mappings>
> > > >
> > > > Thanks,
> > > > Rick
> > > >
> > > > On Thu, Jun 12, 2014 at 9:09 PM, Mansour Al Akeel <
> > > > mansour.alakeel@gmail.com
> > > > > wrote:
> > > >
> > > > > Is the a way to enable cascade persist globally and pro
> grammatically
> > > > using
> > > > > an EntityManager instance ??
> > > > >
> > > > >
> > > > > Thank you.
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > *Rick Curtis*
> > > >
> > >
> >
> >
> >
> > --
> > *Rick Curtis*
> >
>



-- 
*Rick Curtis*

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