@Override
    public NumberExpression<Long> count() {
        if (count == null) {
            if (primaryKey != null) {
                count = Expressions.numberOperation(Long.class, Ops.AggOps.COUNT_AGG,
                        primaryKey.getLocalColumns().get(0));
            } else {
                throw new IllegalStateException("No count expression can be created");
            }
        }
        return count;
    }
{@code RelationalPathBase} is a base class for {@link RelationalPath} implementations

@author tiwe

@param <T>
           entity type
querydsl-sql/src/main/java/com/querydsl/sql/RelationalPathBase.java