I'm building a tree structured Object model. I.o.w. there a single POJO 
(ResourceEJB) with a parent reference (Many to One) and a collection of child 
references (One to Many) which are of the same type.

I have a method which determines all ResourceEJB object that share a certain 
ResourceEJB parent:


  |     public Collection<ResourceEJB>
  |     findByParentID(Long aParentID)
  |     throws DAOException
  |     {        
  |         try
  |         {            
  |             ResourceEJB myParent = null;
  |             if(aParentID != null)
  |                 myParent = (ResourceEJB)findByID(aParentID);
  |             
  |             return theManager.createQuery(
  |                 "from ResourceEJB resource where resource.parent = :parent")
  |                 .setParameter("parent", myParent).getResultList();          
      
  |         }
  |         catch(Exception anException)
  |         {            
  |             throw new DAOException(anException);
  |         }
  |     }
  | 

The problem is that I can't find the 'root' Node, which has a parent value of 
'null'. How can I retrieve an Object using EJB-QL on a parameter which has a 
null value?




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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952263


_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to