quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.5k stars 2.6k forks source link

Support literals in Panache projection #34140

Open sjaakd opened 1 year ago

sjaakd commented 1 year ago

Description

In HQL it is possible to use constants (like below) for DTO projection. This i however not possible (yet) in Panache.

@Entity
@Table(schema = "DINO_DBA", name = "GDW_LKS_SFR_RD")
@NamedQuery(
    name = "GdwLksSfrRd.search",
    query = "select new nl.bro.microservices.dlp.model.common.ObjectDto( p.broId, p.geometry, 'SOIL', 'BRO', 'sfr' ) "
        + "from GdwLksSfrRd p where p.broId like :criterion order by p.broId"
)

See also https://github.com/quarkusio/quarkus/issues/33310

Implementation ideas

A suggestion that has been made in https://github.com/quarkusio/quarkus/issues/33310 is to support static factory methods. That looks like an interesting way forward.

quarkus-bot[bot] commented 1 year ago

/cc @FroMage (panache), @loicmathieu (panache)