Hi!
Phan Anh Tran wrote:
> Is EJB 2.0 going to define how to map a certain class
No, but it says "Thou shall be able to map a certain class".
> or how to specify
> custom finder methods or both?
Yes, there's a new finder language (similar to SQL).
> I am not at all familiar with what is going to
> be in EJB2.0. However, consider this:
>
> public class Person
> {
> private Leg leftLeg;
> private Leg rightLeg;
> }
>
> public class Leg
> {
> private byte length;
> }
>
> [Person]<>----(2)->[Leg]
>
> As you can see, it would be highly inappropriate to implement a PersonEntity
> and a LegEntity to wrap Person and Leg respectively. It makes more sense to
> have one PersonEntity bean with a reference to Person which in turn has a
> reference to Leg.
>
> However, the business logic may require the need to find all people with legs
> of a certain length. In order to support the described query efficiently, one
> would need to map Person to a Table Person and rightLeg/leftLeg to a Table
> Leg.
>
> If one did not map rightLeg and leftLeg to a separate table, one would be forced
> to load all PersonEntity bean one at a time and check their legs - a much more
> inefficient approach than a straight database level sql join.
>
> On the other hand, if there never is a nee to find all people with legs of
> certain length, the bean deployer could choose to stuff the rightLeg/leftLeg
> stuff in one column in the Table Person.
>
> I just want to make sure that EJB2.0 is going to deal with the above O->R
> mapping issues.
It will.
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.ejboss.org
http://www.dreambean.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]