-
1. Re: ejbSelect methods vs CMR
arich Sep 13, 2002 10:16 PM (in response to sonwh98)i dont know if no CMR can we use EJB-QL(or JBoss-QL)
like :
"SELECT detail WHERE detail.master.company.code=?"
nest Object call...
Rich -
2. Re: ejbSelect methods vs CMR
dsundstrom Sep 13, 2002 11:59 PM (in response to sonwh98)> 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? -
3. Re: ejbSelect methods vs CMR
sonwh98 Sep 15, 2002 5:10 PM (in response to sonwh98)> 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()
{
return ejbSelectAddress(getCustomerId());
}
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. -
4. Re: ejbSelect methods vs CMR
dsundstrom Sep 17, 2002 2:34 PM (in response to sonwh98)If you are only going one (or maybe two) level(s) deep use a CMR otherwise use an ejbSelect.