*Rob,*

Thanks for your help. In general, it is always a good idea to explain why
something is a bad idea. Or, maybe, ask for the context in which some
specific feature is needed by the user, because believe it or not, there
are valid use cases for the asterisk even if you may have strong opinions
about it.

*Dharm,*

You can use the DSL.asterisk() expression to create an asterisk in your
query:
https://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#asterisk--

You cannot use that with selectFrom(), but if you want to fetch
PersonRecords from any arbitrary query, you can call fetchInto(PERSON):
https://www.jooq.org/javadoc/latest/org/jooq/ResultQuery.html#fetchInto-org.jooq.Table-

This will transform arbitrary projections back to typed TableRecords.

The reason why jOOQ lists your column names explicitly is because the
generated code was generated against a specific schema version, and in
general, it is a good idea to expect only columns from that specific schema
version to be in the result type - for instance when you use SELECT
DISTINCT. This will produce more predictable results.

I hope this helps,
Lukas

On Wed, Mar 13, 2019 at 10:04 PM Rob Sargent <[email protected]> wrote:

> Let's just agree that this is a bad idea and quietly move on :)
> On 3/13/19 2:50 PM, Dharmaraj Parmar wrote:
>
> Hi,
>
> I would like to know if it is possible to have the generated SQL statement
> contain asterisk instead of listing all the columns.
>
> *JOOQ:*
> ctx.selectFrom(*PERSON*).fetch();
>
> *Expected:*
> select * from PERSON
>
> *Actual:*
>
> select PERSON.ID, PERSON.NAME from PERSON
>
>
>
> Regards,
> Dharm
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to