use of org.apache.cayenne.testdo.uuid.UuidTestEntity in project cayenne by apache.
the class UUIDIT method testUUID.
@Test
public void testUUID() throws Exception {
UuidTestEntity test = context.newObject(UuidTestEntity.class);
UUID id = UUID.randomUUID();
test.setUuid(id);
context.commitChanges();
SelectQuery<UuidTestEntity> q = new SelectQuery<>(UuidTestEntity.class);
UuidTestEntity testRead = (UuidTestEntity) context.performQuery(q).get(0);
assertNotNull(testRead.getUuid());
assertEquals(id, testRead.getUuid());
test.setUuid(null);
context.commitChanges();
}
use of org.apache.cayenne.testdo.uuid.UuidTestEntity in project cayenne by apache.
the class UUIDIT method testUUIDColumnSelect.
@Test
public void testUUIDColumnSelect() throws Exception {
UuidTestEntity test = context.newObject(UuidTestEntity.class);
UUID id = UUID.randomUUID();
test.setUuid(id);
context.commitChanges();
UUID readValue = ObjectSelect.query(UuidTestEntity.class).column(UuidTestEntity.UUID).selectOne(context);
assertEquals(id, readValue);
UUID readValue2 = ObjectSelect.query(UuidTestEntity.class).column(Property.create(ExpressionFactory.dbPathExp("UUID"), UUID.class)).selectOne(context);
assertEquals(id, readValue2);
}
Aggregations