本文整理汇总了Java中org.apache.cayenne.CayenneDataObject类的典型用法代码示例。如果您正苦于以下问题:Java CayenneDataObject类的具体用法?Java CayenneDataObject怎么用?Java CayenneDataObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CayenneDataObject类属于org.apache.cayenne包,在下文中一共展示了CayenneDataObject类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testListeners
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
@Test
public void testListeners() {
L1 l1 = new L1();
CayenneDataObject o1 = new CayenneDataObject();
o1.setObjectId(new ObjectId("T1"));
o1.writeProperty("name", "n" + 1);
CayenneDataObject o2 = new CayenneDataObject();
o2.setObjectId(new ObjectId("T1"));
o2.writeProperty("name", "n" + 2);
ServerRuntime runtime = runtimeWithListeners(l1);
try {
ObjectContext c = runtime.newContext();
c.registerNewObject(o1);
c.registerNewObject(o2);
c.commitChanges();
} finally {
runtime.shutdown();
}
assertEquals(2, l1.postPersisted.size());
assertTrue(l1.postPersisted.contains(o1));
assertTrue(l1.postPersisted.contains(o2));
}
示例2: testFilters
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
@Test
public void testFilters() {
DataChannelFilter f = mock(DataChannelFilter.class);
when(f.onSync(any(), any(), anyInt(), any())).thenReturn(mock(GraphDiff.class));
CayenneDataObject o1 = new CayenneDataObject();
o1.setObjectId(new ObjectId("T1"));
o1.writeProperty("name", "n" + 1);
CayenneDataObject o2 = new CayenneDataObject();
o2.setObjectId(new ObjectId("T1"));
o2.writeProperty("name", "n" + 2);
ServerRuntime runtime = runtimeWithFilters(f);
try {
ObjectContext c = runtime.newContext();
c.registerNewObject(o1);
c.registerNewObject(o2);
c.commitChanges();
} finally {
runtime.shutdown();
}
verify(f).onSync(any(), any(), anyInt(), any());
}
示例3: testBuild_DefaultConfigLoader
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
@Test
public void testBuild_DefaultConfigLoader() {
LmRuntimeBuilder builder = new LmRuntimeBuilder().withTargetRuntime(cayenneRuntime);
LmRuntime runtime = builder.build();
assertNotNull(runtime);
ITaskService taskService = runtime.service(ITaskService.class);
assertNotNull(taskService);
assertNotNull(taskService.createOrUpdate(CayenneDataObject.class));
}
示例4: testBuild
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
@Test
public void testBuild() {
LmRuntimeBuilder builder = new LmRuntimeBuilder().extractorResolver(
mock(ResourceResolver.class)).withTargetRuntime(cayenneRuntime);
LmRuntime runtime = builder.build();
assertNotNull(runtime);
ITaskService taskService = runtime.service(ITaskService.class);
assertNotNull(taskService);
assertNotNull(taskService.createOrUpdate(CayenneDataObject.class));
}
示例5: doSomething2
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
private void doSomething2(SelectContext<DataObject> c) {
c.setObjects(new ArrayList<>());
c.setObjects(new ArrayList<E2>());
List<DataObject> objects = c.getObjects();
objects.add(new CayenneDataObject());
}
示例6: prepareDB
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
private void prepareDB() {
ObjectContext context = cayenneProvider.get().newContext();
context.performGenericQuery(new SQLTemplate("T1", "delete from T1"));
for (int i = 0; i < 10; i++) {
DataObject o = new CayenneDataObject();
o.setObjectId(new ObjectId("T1"));
o.writeProperty("name", "n" + i);
context.registerNewObject(o);
}
context.commitChanges();
}
示例7: doSomething2
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
private void doSomething2(UpdateContext<DataObject> c) {
c.setObjects(new ArrayList<>());
c.setObjects(new ArrayList<E2>());
List<DataObject> objects = c.getObjects();
objects.add(new CayenneDataObject());
}
示例8: getRef
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
@Override
protected CayenneDataObject getRef() {
return ref;
}
示例9: getRef
import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
abstract protected CayenneDataObject getRef();