[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [eclipselink-users] @ManyToMany relationship for a List?
|
- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
- Date: Sat, 29 Nov 2008 13:33:34 -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:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=RrJE3iWLpoQ1l+QYBQlDnke39zY2Y2l16DQy/xBmXjs=; b=WuIO82IjLFL5M+cF2FzXXM92DHhRdU5UoLn7Qluob2hyo72VBPlkd6h3Nv6PqHS3eC 5uBEnCiChQ2OTwSTTCwSGWeq87ADA/QrGPrRhLaPqrvw9W9Ev1J+wVrHAH26vtAJ+4Hp phaV6ZgjOD+DYuH8Oo87NVvn3s81h+ZdC1pBk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ndhgAiYSCZgAdS3PyEzcNVt+xE+YuygIm6jz9AQ2qMAXzuQaQWiJntz6V+BSPVM5ua q2eHU6F1LKSKDuGjSiAnrRpil17ysqzxRfGCyWw7qDMiNSY6xDRnYNpttDjy+fi+Zozv dKKyO+outrEzZfFeSvxSbTvd0oMwiuQ7MP8qc=
Well, I'll refrain from offering the obvious solution - create your
own table - obviously you want DML generation, an area where I haven't
ventured much.
Anyway, on to your second question. Implementing indexed lists. What
do you mean implementing indexed lists on top of JPA?
java.util.List is already indexed..so I don't really follow your question.
./tch
On Sat, Nov 29, 2008 at 12:51 PM, cowwoc <cowwoc@xxxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> A playlist contains multiple music clips. And each clip may be associated
> with multiple playlists. I believe this should be mapped as follows:
>
> class Playlist
> {
> @ManyToMany
> @JoinTable(name="playlist_to_clip")
> List<Clip> getClips();
> }
>
> Unfortunately I can't get this to work. EclipseLink generates a
> "playlist_to_clip" table with two columns: playlist and clip. The primary
> key is the pair [playlist, clip]. In other words, it is impossible for a
> Playlist to contain the same Clip multiple times (which is desirable).
>
> I find the mapping that EclipseLink generates confusing because it seems to
> only make sense for Sets, not Collection or List (I've tried both). If was
> mapping this by hand I'd add an "id" primary key column to the join table
> and allow duplicate [playlist, clip] combinations. Any ideas on how to
> implement this in EclipseLink?
>
> Going one step further, are there existing (unofficial) libraries for
> implementing indexed lists on top of JPA or will I have to write this from
> scratch?
>
> Thank you,
> Gili
> --
> View this message in context: http://www.nabble.com/%40ManyToMany-relationship-for-a-List--tp20749567p20749567.html
> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>