smauel
smauel

Reputation: 1807

Nhibernate relationship table mappings

I am using NHibernate to persist information in my media player app. Basically at the minute I have a mapping setup for the Track class and for the Playlist class:

Track                      Playlist
======                     =========
Id                         Id
Name                       Name
FilePath
etc...

This is working fine. However now I want to create a relationship table between these 2 entities :- PlaylistTracks

PlaylistTracks
===============
PlaylistId
TrackId

The tracks that are in a playlist are held as a list of tracks in the playlist object. My question is how do I create this mapping to get the required table strucutre

thanks in advance

Upvotes: 0

Views: 194

Answers (1)

Jamie Ide
Jamie Ide

Reputation: 49251

Use a many-to-many mapping to achieve this. Are you using XML or fluent mapping?

Upvotes: 1

Related Questions