JPQL ignores OrderBy annotation when using JOIN FETCH [message #998863] |
Thu, 10 January 2013 16:07  |
Eclipse User |
|
|
|
Dear all,
I have little troubles with JPQL and ordering OneToMany and ManyToMany Lists.
Let's say I have an entity class A:
@Entity
public class A implements Serializable {
...
@ManyToMany(fetch = FetchType.LAZY)
@OrderBy("name")
private List<B> bList; // B is also an entity class
...
}
When I load the entity using
entityManager.find(A.class, id) or with query
SELECT entity FROM A entity WHERE entity.id = :id and initialize the lazy list, bList is ordered.
But when I try to load it using JOIN FETCH
SELECT entity FROM A entity LEFT JOIN FETCH entity.bList WHERE entity.id = :id bList is not ordered!
The question is, is it possible to order lists in JPQL with JOIN FETCH?
My env: EclipseLink 2.4.1, MySQL 5.5.28, Glassfish 3.1.2.2, Netbeans 7.2.1, Java 1.6.37.
Thank you
Michael
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25987 seconds