Hi Michael,

here is a sample snippet where accessing the relationship fails with your 
exception:

public MyEntity getEntity(object pk) {
  | MyEntity entity = (MyEntity) entityManager.find(MyEntity.class, pk);
  | //Will NOT load the data !
  | entity.getTdmAlerts();
  | return entity;
  | }

I found that just accessing the collection property of the entity does NOT 
fetch its content.

You have to do something which forces the collection to load its items. In the 
following piece of code I access the collections size:
public MyEntity getEntity(object pk) {
  | MyEntity entity = (MyEntity) entityManager.find(MyEntity.class, pk);
  | int iSize = entity.getTdmAlerts().size();
  | return entity;
  | }

I suggest to add a parameter "boolean bFetchAlerts" to "getEntity" which 
controls whether the alerts are loaded or not.

I hope this helps

Wolfgang

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978736#3978736

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978736
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to