You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Teodoro Cue <tc...@exist.com> on 2009/03/16 15:02:24 UTC

Replication Question

Hi,

I'm using org.apache.openjpa.slice.ReplicationPolicy.Default to replicate
all my entities into a backup DB.
Here is my class structure with flat inheritance strategy:
Interface C

@Entity
@Replicated
Abstract Class AC implements C

@Entity
@Replicated
Class A extends AC
    @OneToMany
    List<C> list;

@Entity
@Replicated
Class X extends AC

During runtime, an instance of class A will have its list field contain many
instances of class X. When I persist it, the first DB contains the complete
number of X instances and the A instance that's holding the list. The second
DB on the other hand, only contains the A entity without the X entities.

Am I doing something wrong?
By the way, the DB that I'm using is Embedded Derby for testing purposes.


-Teody

Re: Replication Question

Posted by Teodoro Cue <tc...@exist.com>.
Hi Pinaki,

I tried building from trunk but there are a couple of classes that lacks
method implementations. So I reverted to using the 2.0.0-SNAPSHOT version in
http://people.apache.org/repo/m2-snapshot-repository

It works! Many thanks for this fix! :)

-Teody



On Tue, Mar 17, 2009 at 4:38 PM, Pinaki Poddar <pp...@apache.org> wrote:

>
> Hi,
>  Welcome to 'bleeding edge' technology - may you live in interesting time
> :)
>  SVN commit 755031 has a change to address the issue you found.
>
>  Yes, Slice is built with maven along with rest of the modules of OpenJPA.
> You can also find a series of test cases for Slice in openjpa-slice/../test
> packages.
>
> Pinaki
>
>
> Teodoro Cue wrote:
> >
> > Hi,
> >
> > Thanks for the reply! It took me a while(about a day) testing various
> > solutions to realize that it must be some sort of a bug.
> >
> > As long as it builds on Maven, I don't have problems working with
> bleeding
> > edge technology. I'll just checkout the source code and update it on a
> > daily
> > basis. :)
> >
> > -Teody
> >
> > On Tue, Mar 17, 2009 at 4:33 AM, Pinaki Poddar <pp...@apache.org>
> wrote:
> >
> >>
> >> Hi,
> >> > A will have its list field contain many instances of class X. When I
> >> > persist it, the first DB contains the
> >> > complete number of X instances and the A instance that's holding the
> >> list.
> >> > The second DB on the other
> >> > hand, only contains the A entity without the X entities.
> >>
> >> This is a consequence of "collocation constraint" imposed by Slice. When
> >> A
> >> is persisted in slice1, all the related X instances are persisted in
> >> slice1
> >> as well automatically by Slice. If A is the 'root' instance (i.e. the
> >> explict argument to persist() call) then Slice checks if A is a
> >> replicated.
> >> But it does not check if anything reachable from A i.e. the list of X is
> >> replicated or not.
> >>
> >> This automatic decision can be relaxed and a JIRA issue OPENJPA-981 [1]
> >> has
> >> been created. I hope to fix it shortly. Is it possible for you to work
> >> with
> >> our nightly builds or you also need this change in earlier branches?
> >>
> >> [1] https://issues.apache.org/jira/browse/OPENJPA-981
> >>
> >>
> >>
> >> Teodoro Cue wrote:
> >> >
> >> > Hi,
> >> >
> >> > I'm using org.apache.openjpa.slice.ReplicationPolicy.Default to
> >> replicate
> >> > all my entities into a backup DB.
> >> > Here is my class structure with flat inheritance strategy:
> >> > Interface C
> >> >
> >> > @Entity
> >> > @Replicated
> >> > Abstract Class AC implements C
> >> >
> >> > @Entity
> >> > @Replicated
> >> > Class A extends AC
> >> >     @OneToMany
> >> >     List<C> list;
> >> >
> >> > @Entity
> >> > @Replicated
> >> > Class X extends AC
> >> >
> >> > During runtime, an instance of class A will have its list field
> contain
> >> > many
> >> > instances of class X. When I persist it, the first DB contains the
> >> > complete
> >> > number of X instances and the A instance that's holding the list. The
> >> > second
> >> > DB on the other hand, only contains the A entity without the X
> >> entities.
> >> >
> >> > Am I doing something wrong?
> >> > By the way, the DB that I'm using is Embedded Derby for testing
> >> purposes.
> >> >
> >> >
> >> > -Teody
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/Replication-Question-tp2486209p2488312.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Teody
> > Senior Software Engr | Exist Global | +63 32 412 1155 | YM: exst_tcue |
> > www.exist.com | Innovation Delivered
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Replication-Question-tp2486209p2490194.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>


-- 
Teody
Senior Software Engr | Exist Global | +63 32 412 1155 | YM: exst_tcue |
www.exist.com | Innovation Delivered

Re: Replication Question

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  Welcome to 'bleeding edge' technology - may you live in interesting time
:) 
  SVN commit 755031 has a change to address the issue you found.

  Yes, Slice is built with maven along with rest of the modules of OpenJPA.
You can also find a series of test cases for Slice in openjpa-slice/../test
packages.

Pinaki


Teodoro Cue wrote:
> 
> Hi,
> 
> Thanks for the reply! It took me a while(about a day) testing various
> solutions to realize that it must be some sort of a bug.
> 
> As long as it builds on Maven, I don't have problems working with bleeding
> edge technology. I'll just checkout the source code and update it on a
> daily
> basis. :)
> 
> -Teody
> 
> On Tue, Mar 17, 2009 at 4:33 AM, Pinaki Poddar <pp...@apache.org> wrote:
> 
>>
>> Hi,
>> > A will have its list field contain many instances of class X. When I
>> > persist it, the first DB contains the
>> > complete number of X instances and the A instance that's holding the
>> list.
>> > The second DB on the other
>> > hand, only contains the A entity without the X entities.
>>
>> This is a consequence of "collocation constraint" imposed by Slice. When
>> A
>> is persisted in slice1, all the related X instances are persisted in
>> slice1
>> as well automatically by Slice. If A is the 'root' instance (i.e. the
>> explict argument to persist() call) then Slice checks if A is a
>> replicated.
>> But it does not check if anything reachable from A i.e. the list of X is
>> replicated or not.
>>
>> This automatic decision can be relaxed and a JIRA issue OPENJPA-981 [1]
>> has
>> been created. I hope to fix it shortly. Is it possible for you to work
>> with
>> our nightly builds or you also need this change in earlier branches?
>>
>> [1] https://issues.apache.org/jira/browse/OPENJPA-981
>>
>>
>>
>> Teodoro Cue wrote:
>> >
>> > Hi,
>> >
>> > I'm using org.apache.openjpa.slice.ReplicationPolicy.Default to
>> replicate
>> > all my entities into a backup DB.
>> > Here is my class structure with flat inheritance strategy:
>> > Interface C
>> >
>> > @Entity
>> > @Replicated
>> > Abstract Class AC implements C
>> >
>> > @Entity
>> > @Replicated
>> > Class A extends AC
>> >     @OneToMany
>> >     List<C> list;
>> >
>> > @Entity
>> > @Replicated
>> > Class X extends AC
>> >
>> > During runtime, an instance of class A will have its list field contain
>> > many
>> > instances of class X. When I persist it, the first DB contains the
>> > complete
>> > number of X instances and the A instance that's holding the list. The
>> > second
>> > DB on the other hand, only contains the A entity without the X
>> entities.
>> >
>> > Am I doing something wrong?
>> > By the way, the DB that I'm using is Embedded Derby for testing
>> purposes.
>> >
>> >
>> > -Teody
>> >
>> >
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Replication-Question-tp2486209p2488312.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Teody
> Senior Software Engr | Exist Global | +63 32 412 1155 | YM: exst_tcue |
> www.exist.com | Innovation Delivered
> 
> 

-- 
View this message in context: http://n2.nabble.com/Replication-Question-tp2486209p2490194.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Replication Question

Posted by Teodoro Cue <tc...@exist.com>.
Hi,

Thanks for the reply! It took me a while(about a day) testing various
solutions to realize that it must be some sort of a bug.

As long as it builds on Maven, I don't have problems working with bleeding
edge technology. I'll just checkout the source code and update it on a daily
basis. :)

-Teody

On Tue, Mar 17, 2009 at 4:33 AM, Pinaki Poddar <pp...@apache.org> wrote:

>
> Hi,
> > A will have its list field contain many instances of class X. When I
> > persist it, the first DB contains the
> > complete number of X instances and the A instance that's holding the
> list.
> > The second DB on the other
> > hand, only contains the A entity without the X entities.
>
> This is a consequence of "collocation constraint" imposed by Slice. When A
> is persisted in slice1, all the related X instances are persisted in slice1
> as well automatically by Slice. If A is the 'root' instance (i.e. the
> explict argument to persist() call) then Slice checks if A is a replicated.
> But it does not check if anything reachable from A i.e. the list of X is
> replicated or not.
>
> This automatic decision can be relaxed and a JIRA issue OPENJPA-981 [1] has
> been created. I hope to fix it shortly. Is it possible for you to work with
> our nightly builds or you also need this change in earlier branches?
>
> [1] https://issues.apache.org/jira/browse/OPENJPA-981
>
>
>
> Teodoro Cue wrote:
> >
> > Hi,
> >
> > I'm using org.apache.openjpa.slice.ReplicationPolicy.Default to replicate
> > all my entities into a backup DB.
> > Here is my class structure with flat inheritance strategy:
> > Interface C
> >
> > @Entity
> > @Replicated
> > Abstract Class AC implements C
> >
> > @Entity
> > @Replicated
> > Class A extends AC
> >     @OneToMany
> >     List<C> list;
> >
> > @Entity
> > @Replicated
> > Class X extends AC
> >
> > During runtime, an instance of class A will have its list field contain
> > many
> > instances of class X. When I persist it, the first DB contains the
> > complete
> > number of X instances and the A instance that's holding the list. The
> > second
> > DB on the other hand, only contains the A entity without the X entities.
> >
> > Am I doing something wrong?
> > By the way, the DB that I'm using is Embedded Derby for testing purposes.
> >
> >
> > -Teody
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Replication-Question-tp2486209p2488312.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>


-- 
Teody
Senior Software Engr | Exist Global | +63 32 412 1155 | YM: exst_tcue |
www.exist.com | Innovation Delivered

Re: Replication Question

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
> A will have its list field contain many instances of class X. When I
> persist it, the first DB contains the 
> complete number of X instances and the A instance that's holding the list.
> The second DB on the other 
> hand, only contains the A entity without the X entities.

This is a consequence of "collocation constraint" imposed by Slice. When A
is persisted in slice1, all the related X instances are persisted in slice1
as well automatically by Slice. If A is the 'root' instance (i.e. the
explict argument to persist() call) then Slice checks if A is a replicated.
But it does not check if anything reachable from A i.e. the list of X is
replicated or not. 

This automatic decision can be relaxed and a JIRA issue OPENJPA-981 [1] has
been created. I hope to fix it shortly. Is it possible for you to work with
our nightly builds or you also need this change in earlier branches?

[1] https://issues.apache.org/jira/browse/OPENJPA-981



Teodoro Cue wrote:
> 
> Hi,
> 
> I'm using org.apache.openjpa.slice.ReplicationPolicy.Default to replicate
> all my entities into a backup DB.
> Here is my class structure with flat inheritance strategy:
> Interface C
> 
> @Entity
> @Replicated
> Abstract Class AC implements C
> 
> @Entity
> @Replicated
> Class A extends AC
>     @OneToMany
>     List<C> list;
> 
> @Entity
> @Replicated
> Class X extends AC
> 
> During runtime, an instance of class A will have its list field contain
> many
> instances of class X. When I persist it, the first DB contains the
> complete
> number of X instances and the A instance that's holding the list. The
> second
> DB on the other hand, only contains the A entity without the X entities.
> 
> Am I doing something wrong?
> By the way, the DB that I'm using is Embedded Derby for testing purposes.
> 
> 
> -Teody
> 
> 

-- 
View this message in context: http://n2.nabble.com/Replication-Question-tp2486209p2488312.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.