I am creating a Quarkus GraphQL using JPAStreamer, I would like to fetch only what I indicated in my query (by the way I'm using sakila database).
Here's the result.
Upon logging the result in sql. it display this SQL statement, I only want description be queried in database. Is there any way for that?
Sample Code:
@GraphQLApi
public class CharacterQuery {
@Inject
JPAStreamer jpaStreamer;
@Query
@Description("Create a film")
public List<Film> fetchAllCharacters(@Name("size") Long size) {
List<Film> data = jpaStreamer.stream(
Projection.select(Film$.filmId,Film$.description, Film$.title) // Is there any way to fetch the query and pass here?
).limit(size).collect(Collectors.toList());
Log.info(String.format("DATA RECIEVED: %s", new Gson().toJson(data)));
return data;
}
}
Entity
@Entity
@Table(name = "film", schema = "sakila")
@Setter
@Getter
public class Film {
Film(){}
public Film(short filmId, String title, String description) {
this.filmId = filmId;
this.title = title;
this.description = description;
}
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "film_id")
private short filmId;
@Basic
@Column(name = "title")
private String title;
@Basic
@Column(name = "description")
private String description;
}

