java - How to retrieve a list/result from a QueryDSL -


i'm using query dsl version 4.0.4 here's dependencies;

<dependency>   <groupid>com.querydsl</groupid>   <artifactid>querydsl-apt</artifactid>   <version>4.0.4</version>   <scope>provided</scope> </dependency>  <dependency>   <groupid>com.querydsl</groupid>   <artifactid>querydsl-jpa</artifactid>   <version>4.0.4</version> </dependency>  <dependency>   <groupid>org.slf4j</groupid>   <artifactid>slf4j-log4j12</artifactid>   <version>1.6.1</version> </dependency> 

and here's snippet of querydsl query.

        jpqlquery query = new jpaquery(em);         qquotation quotation = qquotation.quotation;         query.from(quotation).where(quotation.ticketnumber.like("this")) 

however query method doesn't have list() method when line .where(quotation.ticketnumber.like("this"))

here's full code.

import com.querydsl.jpa.jpqlquery; import com.querydsl.jpa.impl.jpaquery; import org.app.now.domain.process.qquotation; import org.app.now.domain.process.quotation; import org.app.now.repo.quotationrepocustom; import org.joda.time.localdatetime; import org.springframework.beans.factory.annotation.autowired;  import javax.persistence.entitymanager; import java.util.list;  public class quotationrepoimpl implements quotationrepocustom {      @autowired     private entitymanager em;      @override     public list<quotation> search(string ticketnumber, string description, localdatetime startdate, localdatetime enddate) {         system.out.println("searching");         jpqlquery query = new jpaquery(em);         qquotation quotation = qquotation.quotation;         query.from(quotation).where(quotation.ticketnumber.like("this")).         return null;     } } 

take fechable interface.

@override public list<quotation> search(string ticketnumber, string description, localdatetime startdate, localdatetime enddate) {     system.out.println("searching");     jpqlquery query = new jpaquery(em);     qquotation quotation = qquotation.quotation;     return query.from(quotation).where(quotation.ticketnumber.like("this")).fetch(); } 

good luck!


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -