persistence@glassfish.java.net

Re: using composition with JPA

From: Sahoo <Sahoo_at_Sun.COM>
Date: Tue, 24 Jul 2007 11:04:02 +0530

I don't know why the spec authors did not allow @embedded for an entity
type. Anyone knows?

In addition to what Marina said, if you cascade persist and delete to
the related object and fetch eagerly, you effectively simulate
composition using aggregation.

Thanks,
Sahoo

Marina Vatkina wrote:
> You'll have a reference that will give you a snapshot when you
> navigate to it. From the access standpoint it should be the same, and
> you probably won't store the fields of A in the B table.
>
> regards,
> -marina
>
> sud wrote:
>> Inheritance is not possible because the domain classes are really
>> different with different properties and behavior. If I were to use
>> any of the ToMany annotations wouldn't that put back me in a
>> situation of an aggregation where I don't have a snapshot of Class A
>> in Class B. Instead I have a reference to Class A in Class B? Or is
>> there a specific annotation you are mentioning.
>>
>> -sud
>>
>> ------------------------------------------------------------------------
>> Building a website is a piece of cake.
>> Yahoo! Small Business gives you all the tools to get online.
>> <http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhosting/?p=PASSPORTPLUS>
>>