144145146147148149150151152153154
listener, "publicCallback"); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); Painting p1 = context.newObject(Painting.class); p1.setToArtist(a1); p1.setPaintingTitle("XXX"); context.commitChanges(); // reset context and read related object
181182183184185186187188189190191
LifecycleEvent.POST_LOAD, Artist.class, listener, "publicCallback"); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); Painting p1 = context.newObject(Painting.class); p1.setToArtist(a1); p1.setPaintingTitle("XXX"); context.commitChanges();
183184185186187188189190191192193
210211212213214215216217218219220
.getEntityResolver() .getCallbackRegistry(); ObjectContext context = createDataContext(); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); context.commitChanges(); assertFalse(a1.isPreUpdated()); a1.setArtistName("YY");
250251252253254255256257258259260
.getEntityResolver() .getCallbackRegistry(); ObjectContext context = createDataContext(); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); context.commitChanges(); assertFalse(a1.isPostUpdated()); a1.setArtistName("YY");
292293294295296297298299300301302
.getEntityResolver() .getCallbackRegistry(); ObjectContext context = createDataContext(); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); context.commitChanges(); registry.addListener( LifecycleEvent.POST_REMOVE,
322323324325326327328329330331332
.getEntityResolver() .getCallbackRegistry(); ObjectContext context = createDataContext(); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); context.commitChanges(); MockCallingBackListener listener1 = new MockCallingBackListener(); registry.addListener(
378379380381382383384385386387388
LifecycleEvent.POST_UPDATE, Artist.class, listener2, "publicCallback"); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); context.deleteObject(a1); context.commitChanges(); assertNull(listener0.getPublicCalledbackEntity());
395396397398399400401402403404405
LifecycleCallbackRegistry registry = getDomain() .getEntityResolver() .getCallbackRegistry(); ObjectContext context = createDataContext(); Artist a1 = context.newObject(Artist.class); a1.setArtistName("XX"); context.commitChanges(); assertFalse(a1.isPostPersisted()); registry.addListener(
418419420421422423424425426427428
LifecycleEvent.POST_PERSIST, Artist.class, listener2, "publicCallback"); Artist a2 = context.newObject(Artist.class); a2.setArtistName("XX"); context.commitChanges(); assertFalse(a1.isPostPersisted()); assertTrue(a2.isPostPersisted());