Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPQL ignores OrderBy annotation when using JOIN FETCH
JPQL ignores OrderBy annotation when using JOIN FETCH [message #998863] Thu, 10 January 2013 16:07 Go to previous message
Michal Ondrovic is currently offline Michal Ondrovic
Messages: 7
Registered: February 2010
Junior Member
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:eclipselink 2.4 TABLE_PER_TENANT shared EMF
Next Topic:Parameterized SessionCustomizer with spring (or without)
Goto Forum:
  


Current Time: Fri May 24 19:48:04 EDT 2013

Powered by FUDForum. Page generated in 0.01603 seconds