Select all columns using Projections.bean

21 views
Skip to first unread message

feverrepo88

unread,
Apr 27, 2017, 7:27:46 PM4/27/17
to Querydsl
Greetings,

I've read some QueryDSL snipped in which it had access to QObject.object.all()
I'm using QueryDSL 4.1.4.

I have the following query:

        QEstado estado = QEstado.estado;
       
QCidade cidade = QCidade.cidade;
       
       
List<Estado> list = selectFrom(estado)
               
.leftJoin(estado.cidades, cidade)
               
.transform(GroupBy.groupBy(estado.id)
                       
.list(Projections.bean(Estado.class,
                               
estado.id,
                                estado
.nome,

                               
GroupBy.list(cidade).as(estado.cidades))));

How to I select all columns from estado without declaring it one by one?
Something the following would be nice:

        QEstado estado = QEstado.estado;
       
QCidade cidade = QCidade.cidade;
       
       
List<Estado> list = selectFrom(estado)
               
.leftJoin(estado.cidades, cidade)
               
.transform(GroupBy.groupBy(estado.id)
                       
.list(Projections.bean(Estado.class,
                                estado
.all()
                               
GroupBy.list(cidade).as(estado.cidades))));

Sorry for the noobish question, it might sound silly but I've tried a LOT of things before asking here.
Reply all
Reply to author
Forward
0 new messages