[jboss-user] [EJB 3.0] - Re: onetomany relationship question

lpiccoli do-not-reply at jboss.com
Tue Jul 7 07:37:01 EDT 2009


thanks for the rapid response wolfgang.

i added the SQL tracing but there is *no* SQL when calling parent.getChilds().

So if i have understood the 'onetoMany' relationship, it doesnt populated the 'many' unless it has been explicitly set using the parent.setChilds().

This seems an almost pointless relationship.

In order to get the list of childs from existing data (ie.reference data), one must use a join query like


  | em.query( 'from Child child where child.parent_id=:id')
  | 

I was hoping the above would be executed during the retrieval of the 'many'.

Q1. what exactly is the point of the 'onetoMany' if it is only useful if used when explicitly setting the collection on the 'one' side?

any help to clarify the above is most appreciated.

-lp

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

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



More information about the jboss-user mailing list