Sorry; I assumed you were trying to iterate over the collection immediately
after calling "refresh". Where is the code generating the error? Not in that
SLSB snippit posted, but in the JSP?
The List returned from the EntityManager will be a Hibernate Collections class
with a reference to the current session. If you're just looking to get a
"snapshot" of the current data in there at the time its requested, you can
create a new List, put all of the items in the Entity bean's version in it, and
safely return your list for use outside of the session/transaction. Assuming
you're getting the error in the JSP:
public List<TdmAlerts> getAlertsFromEntity(MyEntity entity) {
| entityManager.refresh(entity);
| List<TdmAlerts> tdmAlerts = new ArrayList<TdmAlerts>();
| tdmAlerts.addAll(entity.getTdmAlerts());
| return tdmAlerts;
| }
...I think should do it. Or use a TO/VO.
Manually closing is done by something like:
((HibernateEntityManager)entityManager.getDelegate()).getSession().close();
... or similar
S,
ALR
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978631#3978631
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978631
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user