[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [eclipselink-users] ManyToMany with aditional fields
|
- From: John Arevalo <johnarevalo@xxxxxxxxx>
- Date: Fri, 10 Jul 2009 08:16:24 -0500
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=J3SxGvF3znjAptstQS8x2KlHkR8/AED5N+ePbpxuw34=; b=NJU3vmYwmgpOuyNelTMiCUYUaTmMdJgJd3CfB3v8WKvZpCoBbAYd2+FLTgzdh60Yf8 SGiMNBYqN8cwtaVQfoEXNrZcnjkSmEd8X0rK6EDP0re9uD4h/NDgJnbC8rTBZkebYJ79 smn4OEUMXtYFuPT+lHaMlTGHPs39dZOwlgJo8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=lOB9oCqrk9ZshS556bAvrQz2rAQXGKjGHDEeQTzV27fqPS8W5CD5SlVJHvS7lR8R32 g3/jQkATIhFv1BpI1ylR/AzFXtv7hEVytbLpOZe3Xx6U6ScGm14DBt0h6xfJVJ5T249K PhoEXZ8V1jizZaaD72NYeODCJq4fknoLJqS+Q=
On Thu, Jul 9, 2009 at 4:25 PM, christopher
delahunt<christopher.delahunt@xxxxxxxxxx> wrote:
> Sorry, didn't realize the links where to your classes and not to a
> signature.
> It looks like you put the relationships in your PKClass and just used basic
> types in your ItemOrder class, which is backwards.
> The specification does not allow primary key classes to contain
> relationships - they can only contain basic types.
> Because you are using an embeddable, you do not need to map anything other
> than the quantity in your ItemOrder, and just use itemOrder.id.orderId
> to get at the integer values. If you want to have the relationships, you
> can add Order and Item ManyToOne mappings to the ItemOrder but be sure to
> mark the columns as insertable=false updatable=false so
> that you only have one writable mapping to the column. If you are using the
> latest EclipseLink which implements the @MappedById, you can instead use it
> to point to the corresponding id mapping in the embeddable
> (avoiding having to define the join column name and mark it as
> insertable=false updatable=false).
> Best Regards,
> Chris
>
>
> John Arevalo wrote:
>>
>> Hi, thank you for your quick reply.
>>
>> ItemOrderPK is posted in 1st pastebin link. Full JoinColumn Annotation is:
>> @JoinColumn(name="item_id",referencedColumnName="item_id")
>> @ManyToOne
>> private Item item;
>>
>> --
>> John Arévalo
>> GNU/Linux User #443701
>> http://counter.li.org/
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
Thanks Christopher, it worked perfectly adding non-updatable JoinColumn.
MappedId won't be portable to another JPA implementation, doesn't it?
--
John Arévalo
GNU/Linux User #443701
http://counter.li.org/