Problem with QueryHints.FETCH and ORDER BY clause [message #1064199] |
Tue, 18 June 2013 04:41  |
Eclipse User |
|
|
|
Hi!
just a question.
If I have
@OneToMany(mappedBy="recapito", cascade = {CascadeType.PERSIST,CascadeType.MERGE})
private List<Recapito> r;
and i set
query.setHint(QueryHints.FETCH, "dip.r");
and i execute a query with ORDER BY clause on Recapito attributes, why this sort is not maintained?
|
|
|
|
|
Re: Problem with QueryHints.FETCH and ORDER BY clause [message #1064541 is a reply to message #1064510] |
Wed, 19 June 2013 15:07  |
Eclipse User |
|
|
|
You show a JoinColumn on a ManyToOne that has nothing to order as it references a single Comune entity. Did you put the orderBy on a ManyToOne or ManyToMany, and how are you reading in the owning entity? Also remember that the orderby only applies if the object is loaded from the database, and it is up to the application to maintain this order. If the application creates the owning entity and doesn't have the collection in order, or changes the order, this is what is presented to the application until it is reloaded from the database.
|
|
|
Powered by
FUDForum. Page generated in 0.06330 seconds