use of com.querydsl.core.util.BeanMap in project querydsl by querydsl.
the class CollUpdateClause method execute.
@Override
public long execute() {
int rv = 0;
for (T match : query.fetch()) {
BeanMap beanMap = new BeanMap(match);
for (Map.Entry<Path<?>, Object> entry : paths.entrySet()) {
// TODO : support deep updates as well
String propertyName = entry.getKey().getMetadata().getName();
beanMap.put(propertyName, entry.getValue());
}
rv++;
}
return rv;
}
use of com.querydsl.core.util.BeanMap in project querydsl by querydsl.
the class PathBuilderTest method getByExample.
@SuppressWarnings("unchecked")
private <T> BooleanBuilder getByExample(T entity) {
PathBuilder<T> entityPath = new PathBuilder<T>((Class<T>) entity.getClass(), "entity");
BooleanBuilder conditions = new BooleanBuilder();
Map<String, Object> beanMap = new BeanMap(entity);
for (Map.Entry<String, Object> entry : beanMap.entrySet()) {
if (!entry.getKey().equals("class")) {
if (entry.getValue() != null) {
conditions.and(entityPath.get(entry.getKey()).eq(entry.getValue()));
}
}
}
return conditions;
}
Aggregations