Select * without Q types.

708 views
Skip to first unread message

Tullio Bettinazzi

unread,
May 4, 2016, 4:10:59 AM5/4/16
to Querydsl
Quite stupid question from a newbie.
I need to select all fields from a table.
I don't use Qtypes.
I use querydsl-sql.
How can I write "select *" ?
query.list(????).
Tks
Tullio

Ruben Dijkstra

unread,
May 4, 2016, 7:05:25 AM5/4/16
to Querydsl
You can use SQLExpressions.all to serialize *

Tullio Bettinazzi

unread,
May 4, 2016, 10:58:27 AM5/4/16
to Querydsl
Using SQLExpression.all I'm forced to change the data type returned from query.list() fro List<Tuple> to List<Object[]> and then I should kwon the position in the array of every field.
Is there any way to get a List<Tuple> using a "select *".
Tks

Ruben Dijkstra

unread,
May 4, 2016, 12:36:56 PM5/4/16
to Querydsl
I see that there is a way to express it, (as in, it compiles, it runs, etc) but that doesn't yet work.

I'll make an issue for it.

Tullio Bettinazzi

unread,
May 5, 2016, 5:26:01 AM5/5/16
to Querydsl
If, at present, there's no way to do a SELECT * is there, at least a way to indicate columns to be listed one by one.
I mean substitute
        List<Tuple> lista = query.list(prevId,stato);
with
       query.addColumn(prevId);
      query.addColumn(stato)
      List<Tuple> lista = query.list();
where addColumn is a method I invented and You could suggest ?
I don't know a priori names of all columns I sholud read and I get them from metadata.
Tks
Reply all
Reply to author
Forward
0 new messages