Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ManyToMany with aditional fields

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


Back to the top