querydsl

Using @RepositoryDefinition and JpaSpecificationExecutor methods doesn't work

…衆ロ難τιáo~ 提交于 2019-12-12 05:28:39
问题 I'm having a Spring Data repository class like: @RepositoryDefinition(domainClass = Book.class, idClass = Long.class) public interface BookRepository { List<Book> findAll(); List<Book> findByOrderByPublishDateDesc(); Book findOne(Long id); Book save(Book book); boolean exists(Long id); void delete(Long id); Iterable<Book> findAll(Predicate predicate, OrderSpecifier<?>... orders); } The standard crud methods do work, however the findAll (from JpaSpecificationExecutor) doesn't work. Do

Elastic search aggregation with range query

心已入冬 提交于 2019-12-12 03:29:57
问题 I am working to build a ES query that satisfies the condition >= avg . Here is an example: GET /_search { "size" : 0, "query" : { "filtered": { "filter": { "range": { "price": { "gte": { "aggs" : { "single_avg_price": { "avg" :{ "field" : "price" } } } } } } } } } } I get the following error "type": "query_parsing_exception", "reason": "[range] query does not support [aggs]", I wonder how do we use aggregated value with range query in Elastic query 回答1: You cannot embed aggregations inside a

neo4j java node dynamic properties

纵然是瞬间 提交于 2019-12-12 03:06:49
问题 I am trying to create nodes of a specific type with properties which can be dynamic . For Example : I can create a Person node with name,age,address properties. But these need not be the only properties when I create another Person node. This node can have name,age,address and an additional property salary. Using spring data or query DSL needs me to create Java POJO class Person with fixed number of instance variables name,age and address . @NodeEntity public class Person { @GraphId private

Query dsl returning duplicate records on @one to many association(leftJoin vs leftJoin.fetch vs fetchAll)

爷,独闯天下 提交于 2019-12-12 02:50:37
问题 Here is my scenario: i have person entity which looks like below. @Entity public class Person{ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private Set<PhoneNumber> phoneNumbers = new HashSet<>(0); @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "AGENCY_ID") private Agency agency; I am unable to retrieve correct data,when i query for persons. Problems i have : 1. duplicate records. 2. person with no agency not returning . 3. Bad performance Here is what i tried, and see

Configuring QueryDSL for Spring Data and MongoDB with Gradle

会有一股神秘感。 提交于 2019-12-12 01:44:58
问题 I guess I haven't configured the repositories properly, but there are other problems too with the following build.gradle: buildscript { repositories { mavenCentral() maven { url "http://repo.spring.io/libs-snapshot" } jcenter() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE") classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7" } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot'

Spring with Querydsl : Null Pointer Exception

淺唱寂寞╮ 提交于 2019-12-11 15:39:18
问题 I am trying to implement Search filter functionality and load grid in spring boot data JPA application. For creating dynamic query I am using Querydsl . I am searching data according to sFloor and nBuildId. If I am passing sFloor, nBuildId only that matching record should display in grid If I am not passing any values then grid should load with all values. I tried like below In that when I am passing data I am able to filter data. But when I am not passing any records I am getting null

Left join operation performed in querydsl gives 'path expected error in querydsl'

牧云@^-^@ 提交于 2019-12-11 12:28:37
问题 Here is my code: QueryFactory.selectFrom(table1) .leftJoin(table2).on(table1.id.eq(table2.id)).fetch(); When I execute the below code in querydsl I get the following error: 08:08:54.866 ERROR o.h.h.i.a.ErrorCounter - Path expected for join! 08:08:54.870 ERROR o.h.h.i.a.ErrorCounter - Path expected for join! antlr.SemanticException: Path expected for join! at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:369) ~[hibernate-core-4.2.1.Final.jar:4.2.1.Final]

QueryDSL: extract Table name from Predicate (BooleanExpression) object

守給你的承諾、 提交于 2019-12-11 12:13:15
问题 A method is dynamically building a list of Predicate s that is later passed to a database service object. In order to create table joins based on the predicate list I need to determine the underlying generated class Q* of each predicate. Calling getType() or getClass() on the Predicate doesn't help. This is how I build the predicates: Class<?> tableClazz = Class.forName("foo.bar.database.model.Q"+ WordUtils.capitalize(tableName)); Object tableObj = tableClazz.getConstructor(String.class)

Issue with apt-maven-plugin and com.mysema.query.apt.roo.RooAnnotationProcessor

女生的网名这么多〃 提交于 2019-12-11 11:09:03
问题 I am unable to generate Q classes from my @RooJpaEntity annotated classes. Here is my plugin configuration: <plugin> <groupId>com.mysema.maven</groupId> <artifactId>apt-maven-plugin</artifactId> <version>1.0.8</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>process</goal> </goals> <configuration> <outputDirectory>src/main/java</outputDirectory> <processor>com.mysema.query.apt.roo.RooAnnotationProcessor</processor> <options> <querydsl.packageSuffix>.querydsl<

How queryDSL works with interface?

我只是一个虾纸丫 提交于 2019-12-11 10:23:07
问题 I have a set of classes that implements the same interface. For example: public interface Employee{ private String name; public void work(); public String getName(); } @PersistenceCapable(detachable = "true") public class Accountant implements Employee{ } @PersistenceCapable(detachable = "true") public class Secretary implements Employee{ } And another class that holds the Employee implementations: public class Department{ private ArrayList<Employee> employees; public ArrayList<Employee>