Same problem here, i have a named query like this:
@NamedQueries({
@NamedQuery(name = "Usuario.findByLoginPassword", query =
"SELECT u "
+ "FROM Usuario u "
+ "LEFT JOIN FETCH u.usuarioSistemaSet "
+ "WHERE u.login = :login AND u.password = :password")})
The query shows well (with the join), but the collection is loaded as a proxy, i've already tried Hibernate.initialize(user.getMyCollection()) and user.getMyCollection().size(), and even if i try to acces mi collection atributes inside the same method, everything works fine, but when i try to make user.getMyCollection() outside, in my session bean (i'm using JPA, hibernate 4 and Java EE 6) stills throwing the dam No Session exception, i've been searching how to convert my entity to an object to avoid this, but i'm still without luck, any suggestions?
Same problem here, i have a named query like this:
@NamedQueries({ @NamedQuery(name = "Usuario.findByLoginPassword", query = "SELECT u " + "FROM Usuario u " + "LEFT JOIN FETCH u.usuarioSistemaSet " + "WHERE u.login = :login AND u.password = :password")})
The query shows well (with the join), but the collection is loaded as a proxy, i've already tried Hibernate.initialize(user.getMyCollection()) and user.getMyCollection().size(), and even if i try to acces mi collection atributes inside the same method, everything works fine, but when i try to make user.getMyCollection() outside, in my session bean (i'm using JPA, hibernate 4 and Java EE 6) stills throwing the dam No Session exception, i've been searching how to convert my entity to an object to avoid this, but i'm still without luck, any suggestions?