Search in sources :

Example 1 with OQueryModel

use of ru.ydn.wicket.wicketorientdb.model.OQueryModel in project wicket-orientdb by OrienteerBAP.

the class TestModels method testOQueryModelDBTouch.

@Test
public void testOQueryModelDBTouch() {
    OClass classA = wicket.getTester().getSchema().getClass("ClassA");
    ODocument doc = new ODocument(classA);
    doc.field("other", Arrays.asList(doc));
    OQueryModel<ODocument> queryModel = new OQueryModel<ODocument>("select  from ClassA where :doc in other");
    queryModel.setParameter("doc", new ODocumentModel(doc));
    long was = classA.count();
    assertTrue(doc.getIdentity().isNew());
    assertEquals(0, queryModel.size());
    assertTrue(doc.getIdentity().isNew());
    assertEquals(was, classA.count());
}
Also used : OClass(com.orientechnologies.orient.core.metadata.schema.OClass) ODocumentModel(ru.ydn.wicket.wicketorientdb.model.ODocumentModel) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) OQueryModel(ru.ydn.wicket.wicketorientdb.model.OQueryModel) Test(org.junit.Test)

Aggregations

OClass (com.orientechnologies.orient.core.metadata.schema.OClass)1 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)1 Test (org.junit.Test)1 ODocumentModel (ru.ydn.wicket.wicketorientdb.model.ODocumentModel)1 OQueryModel (ru.ydn.wicket.wicketorientdb.model.OQueryModel)1