I am interested in this also.
2006/10/18, Marko <mpistotni..mail.com>:
>
> Hi, list!
>
> I have a problem setting up a shared cache between two JVMs. The changes
> in the JVM A don't all get propagated to JVM B. Here's the code:
>
> JVM A:
>
> // The following doesn't trigger the remote snapshot event...
> DataContext context = DataContext.createDataContext();
> Dbe001 e001 = (Dbe001)context.createAndRegisterNewObject(
> Dbe001.class);
> e001.setA002(777);
> context.commitChanges();
>
> // While this does...
> SelectQuery query = new SelectQuery(Dbe001.class);
> List<Dbe001> artists = context.performQuery(query);
> artists.get(0).setA002(237846);
> context.commitChanges();
>
> JVM B:
>
> SnapshotEventListener customListener = new
> DCSnapshotEventListener();
>
> DataDomain domain = Configuration.getSharedConfiguration()
> .getDomain();
>
> domain.getEventManager().addListener(customListener,
> "snapshotsChanged", SnapshotEvent.class,
> domain.getSharedSnapshotCache
> ().getSnapshotEventSubject(),
> domain.getSharedSnapshotCache());
>
> System.in.read();
>
>
> class DCSnapshotEventListener
> implements SnapshotEventListener
> {
> public void snapshotsChanged(SnapshotEvent event)
> {
> Map<ObjectId, DataRow> diff = event.getModifiedDiffs();
> System.err.println(diff);
> }
> }
>
>
> The data object looks like this:
>
> public class _Dbe001 extends org.apache.cayenne.CayenneDataObject {
>
> public static final String A002_PROPERTY = "a002";
>
> public static final String A001_PK_COLUMN = "a001";
>
> public void setA002(Integer a002) {
> writeProperty("a002", a002);
> }
> public Integer getA002() {
> return (Integer)readProperty("a002");
> }
>
>
> }
>
>
> And the database entity is as follows:
>
> <data-map project-version="2.0">
> <db-entity name="dbe001">
> <db-attribute name="a001" type="INTEGER"
> isPrimaryKey="true"
> isMandatory="true"/>
> <db-attribute name="a002" type="INTEGER"/>
> </db-entity>
> <obj-entity name="Dbe001" className="Dbe001"
> dbEntityName="dbe001">
> <obj-attribute name="a002" type="java.lang.Integer"
> db-attribute-path="a002"/>
> </obj-entity>
> </data-map>
>
>
> The transport layer is JGroups with default settings. Any ideas?
>
>
This archive was generated by hypermail 2.0.0 : Thu Oct 26 2006 - 03:32:38 EDT