I am wondering if there is any neater way to do the following.
| s = (Session) em.createQuery(
| "SELECT DISTINCT s " +
| "FROM Session as s " +
| "WHERE s.sessionId = :sessionId")
| .setParameter("sessionId", sessionId)
| .getSingleResult();
| for(SessionSupplier sessionSupplier:s.getSessionSuppliers())
| {
| sessionSupplier.getSessionSupplierLocations().size();
| }
|
the SessionSupplier entity has a many relationship to one session, and the
sessionSupplierLocation is the same to SessionSupplier. They both have a fetch
type of LAZY from their parent objects.
I am basically wondering if i can initialize these child entities through the
EJBQL?
I tried using something like
s = (Session) em.createQuery(
| "SELECT DISTINCT s " +
| "FROM Session as s " +
| "LEFT JOIN FETCH s.sessionSuppliers as ss " +
| "LEFT JOIN FETCH ss.sessionSupplierLocations as ssl " +
| "WHERE s.sessionId = :sessionId")
| .setParameter("sessionId", sessionId)
| .getSingleResult();
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949060#3949060
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949060
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user