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.
