当前位置: 首页>>代码示例>>Java>>正文


Java CayenneDataObject类代码示例

本文整理汇总了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));
}
 
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:29,代码来源:CayenneModule_ListenersIT.java

示例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());
}
 
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:28,代码来源:CayenneModule_ListenersIT.java

示例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));
}
 
开发者ID:nhl,项目名称:link-move,代码行数:12,代码来源:LmRuntimeBuilderTest.java

示例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));
}
 
开发者ID:nhl,项目名称:link-move,代码行数:12,代码来源:LmRuntimeBuilderTest.java

示例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());
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:8,代码来源:DefaultSelectBuilderTest.java

示例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();
}
 
开发者ID:bootique,项目名称:bootique-bom,代码行数:17,代码来源:RunQueryCommand.java

示例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());
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:7,代码来源:DefaultUpdateBuilderTest.java

示例8: getRef

import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
@Override
protected CayenneDataObject getRef() {
	return ref;
}
 
开发者ID:loli10K,项目名称:doujindb,代码行数:5,代码来源:BookImpl.java

示例9: getRef

import org.apache.cayenne.CayenneDataObject; //导入依赖的package包/类
abstract protected CayenneDataObject getRef(); 
开发者ID:loli10K,项目名称:doujindb,代码行数:2,代码来源:RecordImpl.java


注:本文中的org.apache.cayenne.CayenneDataObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。