Search in sources :

Example 6 with MetaEntity

use of io.crnk.jpa.meta.MetaEntity 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());
}
Also used : MetaKey(io.crnk.meta.model.MetaKey) MetaEntity(io.crnk.jpa.meta.MetaEntity) MetaAttribute(io.crnk.meta.model.MetaAttribute)

Aggregations

MetaEntity (io.crnk.jpa.meta.MetaEntity)6 MetaKey (io.crnk.meta.model.MetaKey)3 Test (org.junit.Test)3 MetaAttribute (io.crnk.meta.model.MetaAttribute)2 DefaultPagedMetaInformation (io.crnk.core.resource.meta.DefaultPagedMetaInformation)1 JpaResource (io.crnk.jpa.annotations.JpaResource)1 MetaJpaDataObject (io.crnk.jpa.meta.MetaJpaDataObject)1 MethodAnnotatedEntity (io.crnk.jpa.model.MethodAnnotatedEntity)1 MetaElement (io.crnk.meta.model.MetaElement)1 Serializable (java.io.Serializable)1