quarkusio / quarkus

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

Handling views with Panache #34328

Open g-apparence opened 1 year ago

g-apparence commented 1 year ago

Description

Using views with Quarkus / panache is today a bit tricky. With version 3 this aint working anymore. I used to

With Quarkus 3 this aint working anymore.

So now I found another solution with using @SubSelect.

Implementation ideas

Maybe we could have something similar as Spring boot

@Entity
@Immutable
@Table(name= "myview")
public class ChessGameView {

    @Id
    private Long id;

    private int gameRound;

    private String tournamentName;

    public Long getId() {
        return id;
    }

    public int getGameRound() {
        return gameRound;
    }

    public String getTournamentName() {
        return tournamentName;
    }
}

Or something way easyer

@EntityView(name= "my_view")
public class ChessGameView {

    @Id
    private Long id;

    private int gameRound;

    private String tournamentName;

    public Long getId() {
        return id;
    }

    public int getGameRound() {
        return gameRound;
    }

    public String getTournamentName() {
        return tournamentName;
    }
}

Maybe there's some other better choice of handling this with quarkus but there is nothing about it. Could be helpful to add something about this in the panache wiki.

(Good job about this Quarkus 3 release, really loving all that new stuff)

quarkus-bot[bot] commented 1 year ago

/cc @FroMage (panache), @Sgitario (rest-data-panache), @loicmathieu (panache)