I am pretty new in Hibernate and I have the following doubt.
Into a class I have this field that retrieve a list of Twp1007Progetto objects:
@OneToMany(fetch=FetchType.EAGER)
@JoinColumns({
@JoinColumn(name="COD_MEC_ATT", referencedColumnName="COD_SCU_UT"),
@JoinColumn(name="DAT_ANN_SCO_ATT", referencedColumnName="DAT_ANN_SCO_RIL")
})
private List<Twp1007Progetto> twp1007Progettos;
This works fine but now I have to add an order behavior.
So the Twp1007Progetto object have this String field:
@Column(name="FLG_TIP_PRG")
private String flgTipPrg;
which can have only the following values (these values are defined into the DB): W or L or C or L or S).
So now I want use Hibernet to order the previous twp1007Progettos list according to the flgTipPrg value.
So for example if the list contains two W element, three C element and one S element, the retrieved list have to be something like: [C, C, S, W] (alphabetically ordered).
How can I do something like this using Hibernate?