use of io.crnk.meta.model.MetaKey in project crnk-framework by crnk-project.
the class JpaCriteriaQueryBackend method getParentIdExpression.
private Expression<?> getParentIdExpression(MetaAttribute parentAttr) {
MetaEntity parentEntity = (MetaEntity) parentAttr.getParent();
MetaKey primaryKey = parentEntity.getPrimaryKey();
List<MetaAttribute> elements = primaryKey.getElements();
PreconditionUtil.assertFalse("composite primary keys not supported yet", elements.size() != 1);
MetaAttribute primaryKeyAttr = elements.get(0);
return parentFrom.get(primaryKeyAttr.getName());
}
use of io.crnk.meta.model.MetaKey in project crnk-framework by crnk-project.
the class MetaRelationshipRepositoryImplTest method findOneTargetReturnsResult.
@Test
public void findOneTargetReturnsResult() {
MetaResource resource = resourceProvider.getMeta(Task.class);
MetaKey key = (MetaKey) repo.findOneTarget(resource.getId(), "primaryKey", new QuerySpec(MetaElement.class));
Assert.assertNotNull(key);
Assert.assertEquals("id", key.getUniqueElement().getName());
}
Aggregations