I\'m trying to use the QueryDslPredicateExecutor with MongoDB and Spring-Data, but it seems to be choking on the \"exists()\" property.
I\'m using -
I ended up solving this by having my base repository extend and implement the QueryDslPredicateExecutor, rather than the higher level repository.
// Custom repository interface
@NoRepositoryBean
public interface ExtendedMongoRepository extends MongoRepository, QueryDslPredicateExecutor{
public Page query(Query query, Pageable pageable);
}
// Custom Repository Implementation
public abstract class ExtendedMongoRepositoryImpl extends QueryDslMongoRepository
implements ExtendedMongoRepository {
private Class clazz;
private MongoOperations mongoOperations;
@SuppressWarnings("unused")
private MongoEntityInformation metadata;
public ExtendedMongoRepositoryImpl(MongoEntityInformation metadata, MongoOperations mongoOperations) {
super(metadata, mongoOperations);
this.mongoOperations = mongoOperations;
this.clazz = metadata.getJavaType();
this.metadata = metadata;
}
@Override
public Page query(Query query, Pageable pageable) {
List list = mongoOperations.find(query.with(pageable), clazz);
return new PageImpl(list, pageable, list.size());
}
}
// Entity Repository Interface
public interface TreeRepository extends ExtendedMongoRepository {}