Java 类javax.persistence.criteria.MapJoin 实例源码

项目:wte4j    文件:WordTemplateQuery.java   
private Predicate buildPropertyRestriction(
        MapJoin<PersistentTemplate, String, String> propertiesMap,
        Map<String, String> someProperties) {
    Path<?> keyPath = propertiesMap.key();
    Path<?> valuePath = propertiesMap.value();
    List<Predicate> keyValuePairs = new LinkedList<Predicate>();
    for (Map.Entry<String, String> entry : someProperties.entrySet()) {
        Predicate keyPredicate = criteriaBuilder.equal(keyPath,
                entry.getKey());
        Predicate valuePredicate = criteriaBuilder.equal(valuePath,
                entry.getValue());
        Predicate keyValuePair = criteriaBuilder.and(keyPredicate,
                valuePredicate);
        keyValuePairs.add(keyValuePair);
    }
    return criteriaBuilder.or(keyValuePairs
            .toArray(new Predicate[keyValuePairs.size()]));
}
项目:hawkbit    文件:RSQLUtility.java   
@SuppressWarnings("unchecked")
private Predicate mapToMapPredicate(final ComparisonNode node, final Path<Object> fieldPath,
        final A enumField) {
    if (!enumField.isMap()) {
        return null;
    }
    final String[] graph = node.getSelector().split("\\" + FieldNameProvider.SUB_ATTRIBUTE_SEPERATOR);
    final String keyValue = graph[graph.length - 1];
    if (fieldPath instanceof MapJoin) {
        // Currently we support only string key .So below cast is safe.
        return cb.equal(cb.upper((Expression<String>) (((MapJoin<?, ?, ?>) fieldPath).key())),
                keyValue.toUpperCase());
    }

    return cb.equal(cb.upper(fieldPath.get(enumField.getKeyFieldName())), keyValue.toUpperCase());
}
项目:katharsis-framework    文件:JpaCriteriaQueryBackend.java   
@Override
public Expression<?> joinMapValue(Expression<?> currentCriteriaPath, MetaAttribute pathElement, Object key) {
    MapJoin<Object, Object, Object> mapJoin = ((From<?, ?>) currentCriteriaPath).joinMap(pathElement.getName(),
            JoinType.LEFT);
    Predicate mapJoinCondition = cb.equal(mapJoin.key(), key);
    Predicate nullCondition = cb.isNull(mapJoin.key());
    addPredicate(cb.or(mapJoinCondition, nullCondition));
    return mapJoin;
}
项目:springJpaKata    文件:SampleRepo.java   
public List<Object> findMapJoin() {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Object> c = cb.createQuery();
    Root<Employee> emp = c.from(Employee.class);
    EntityType<Employee> emp_ = emp.getModel();
    MapJoin<Employee, String, Phone> phone = emp.join(emp_.getMap("phones", String.class, Phone.class));
    c.multiselect(emp.get(emp_.getSingularAttribute("name", String.class)), phone.key(), phone.value());

    return em.createQuery(c).getResultList();
}
项目:wte4j    文件:WordTemplateQuery.java   
public WordTemplateQuery hasProperties(Map<String, String> someProperties) {
    Subquery<Long> subQuery = query.subquery(Long.class);
    Root<PersistentTemplate> fromSubQuery = subQuery
            .from(PersistentTemplate.class);
    Path<Long> id = fromSubQuery.get("id");
    subQuery.select(id);
    MapJoin<PersistentTemplate, String, String> propertiesMap = fromSubQuery
            .joinMap("properties", JoinType.INNER);
    subQuery.where(buildPropertyRestriction(propertiesMap, someProperties));
    subQuery.groupBy(id);
    subQuery.having(criteriaBuilder.equal(criteriaBuilder.count(id),
            someProperties.size()));
    restrictions.add(persistentTemplate.get("id").in(subQuery));
    return this;
}
项目:tap17-muggl-javaee    文件:MugglFrom.java   
@Override
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map) {
    // TODO Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件:MugglFrom.java   
@Override
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map,
        JoinType jt) {
    // TODO Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件:MugglFrom.java   
@Override
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName) {
    // TODO Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件:MugglFrom.java   
@Override
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName,
        JoinType jt) {
    // TODO Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件:MugglCriteriaBuilder.java   
@Override
public <X, K, T, V extends T> MapJoin<X, K, V> treat(MapJoin<X, K, T> join,
        Class<V> type) {
    // TODO Auto-generated method stub
    return null;
}
项目:hibernate-semantic-query    文件:CriteriaBuilderImpl.java   
@Override
    @SuppressWarnings("unchecked")
    public <X, K, T, V extends T> MapJoin<X, K, V> treat(MapJoin<X, K, T> join, Class<V> type) {
//      return ( (MapJoinImplementor) join ).treatAs( type );
        throw new NotYetImplementedException(  );
    }
项目:hexa.tools    文件:RootImpl.java   
@Override
public <K, V> MapJoin<T, K, V> join( MapAttribute<? super T, K, V> arg0 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:hexa.tools    文件:RootImpl.java   
@Override
public <K, V> MapJoin<T, K, V> join( MapAttribute<? super T, K, V> arg0, JoinType arg1 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:hexa.tools    文件:RootImpl.java   
@Override
public <X, K, V> MapJoin<X, K, V> joinMap( String arg0 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:hexa.tools    文件:RootImpl.java   
@Override
public <X, K, V> MapJoin<X, K, V> joinMap( String arg0, JoinType arg1 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:raidenjpa    文件:RaidenRoot.java   
@Override
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map) {
    // TODO Auto-generated method stub
    return null;
}
项目:raidenjpa    文件:RaidenRoot.java   
@Override
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map,
        JoinType jt) {
    // TODO Auto-generated method stub
    return null;
}
项目:raidenjpa    文件:RaidenRoot.java   
@Override
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName) {
    // TODO Auto-generated method stub
    return null;
}
项目:raidenjpa    文件:RaidenRoot.java   
@Override
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName, JoinType jt) {
    // TODO Auto-generated method stub
    return null;
}