hi!
i'm looking for a solution to the following problem:
i have a post and a media table. a post has a set of media elements:
Code:
@ManyToMany(fetch = FetchType.EAGER)
public Set<Media> getMedia() {
return media;
}
the table structure looks like this:
table post (title, text)
table media (title, url)
table post_media (post_pk, media-pk)
now i want to be able to control the order of the media elements for a post, in fact if i submit the post initially but i also want to be able to change the order of the posts' media elements later on after the post has been submitted.
so my problem is that a media element can be referenced in more than one post, so i can't just add an int order property to my media element which i can use to sort the media elements in my client code.