Search in sources :

Example 6 with EntityResult

use of org.apache.cayenne.map.EntityResult in project cayenne by apache.

the class SelectQueryMetadata method buildEntityIdResultForColumn.

/**
 * Collect metadata for result with ObjectId (used for paginated queries with FullObject columns)
 *
 * @param column full object column
 * @param resolver entity resolver
 * @return Entity result
 */
private EntityResult buildEntityIdResultForColumn(Property<?> column, EntityResolver resolver) {
    EntityResult result = new EntityResult(column.getType());
    DbEntity entity = resolver.getObjEntity(column.getType()).getDbEntity();
    for (DbAttribute attribute : entity.getPrimaryKeys()) {
        result.addDbField(attribute.getName(), attribute.getName());
    }
    return result;
}
Also used : DbEntity(org.apache.cayenne.map.DbEntity) DbAttribute(org.apache.cayenne.map.DbAttribute) EntityResult(org.apache.cayenne.map.EntityResult)

Aggregations

EntityResult (org.apache.cayenne.map.EntityResult)6 DbAttribute (org.apache.cayenne.map.DbAttribute)4 ObjRelationship (org.apache.cayenne.map.ObjRelationship)4 ClassDescriptor (org.apache.cayenne.reflect.ClassDescriptor)4 HashSet (java.util.HashSet)3 DbJoin (org.apache.cayenne.map.DbJoin)3 DbRelationship (org.apache.cayenne.map.DbRelationship)3 ObjAttribute (org.apache.cayenne.map.ObjAttribute)3 AttributeProperty (org.apache.cayenne.reflect.AttributeProperty)3 PropertyVisitor (org.apache.cayenne.reflect.PropertyVisitor)3 ToManyProperty (org.apache.cayenne.reflect.ToManyProperty)3 ToOneProperty (org.apache.cayenne.reflect.ToOneProperty)3 EJBQLException (org.apache.cayenne.ejbql.EJBQLException)2 DbEntity (org.apache.cayenne.map.DbEntity)2 SQLResult (org.apache.cayenne.map.SQLResult)2 HashMap (java.util.HashMap)1 CayenneRuntimeException (org.apache.cayenne.CayenneRuntimeException)1 EJBQLCompiledExpression (org.apache.cayenne.ejbql.EJBQLCompiledExpression)1 EJBQLExpression (org.apache.cayenne.ejbql.EJBQLExpression)1 Expression (org.apache.cayenne.exp.Expression)1