i dont know if no CMR can we use EJB-QL(or JBoss-QL)
"SELECT detail WHERE detail.master.company.code=?"
nest Object call...
> Is there an advantage of using CMR over using
> ejbSelect for building relationships?
What do you mean? I strongly suggest you use ejbSelects instead of walking the relationship graph as a walk requires a loading all the intermediate objects and an ejbSelect basically jumps there. Is that what you mean?
> What do you mean? I strongly suggest you use
> ejbSelects instead of walking the relationship graph
> as a walk requires a loading all the intermediate
> objects and an ejbSelect basically jumps there. Is
> that what you mean?
For example, suppose customer can have one address.
We can use CMR or Customer can have an
public AddressLocal getAddress()
public AddressLocal ejbSelectAddress(long customerId)
the EJB-QL for the ejbSelectAddress would be like
select Object(a) from Address a where a.customerId=?1
so my question is is it better to build relationships this way using ejbSelect methods or using CMR? The ejbSelect method would be the most flexible. If there are no FK relationship between tables then CMR would not work.
If you are only going one (or maybe two) level(s) deep use a CMR otherwise use an ejbSelect.