Querydsl sets the fetch mode in a query

I have a situation where the map object has a foreign key for the Person.

public class Card implements java.io.Serializable { private String cardid; private Person person; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="USERID") public Person getPerson() { return this.person; } } 

The default fetch type for the LAZY user. Can I specify the sample type for EAGER in the request:

 QCard qCard = QCard.card; JPQLQuery query = getQuery().from(qCard); query.list(qCard); 

Thanks for any help.

+7
java hibernate querydsl
source share
1 answer

You tried

 QCard qCard = QCard.card; List<Card> cards = getQuery().from(qCard) .innerJoin(qCard.person).fetch() .list(qCard); 
+12
source share

All Articles