I have the following entity, and i want to order the list of typeValuesList by the field TypeValues -> name (string) in descending order. I want to do this conditionally only when the description is equals to "1" for example. I tried with the @OrderBy annotation but that does not seem to work conditionally, what are my options in this case, can i go with a query?
@Column(name = "DESCRIPTION", length = 300) @Size(max = 150) private String description; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="TYPE_ID", nullable = false) private List<TypeValues> typeValuesList = new ArrayList<>();
Anonymous Asked question May 14, 2021