Hibernate version: 1.2
Name and version of the database you are using: MSSQL 2005
I'm looking for some/advice direction regarding a mapping scenario and haven't been able to locate any leads on this yet. Here's the deal:
Have 3 tables, as follows:
Code:
CREATE TABLE [Songs] (
[MediaKey] varchar (100) NOT NULL PRIMARY KEY,
[Title] varchar (255),
[Artist] varchar (255),
etc...
);
CREATE TABLE [Stations] (
[StationId] varchar (100) NOT NULL PRIMARY KEY,
[MembershipId] varchar (100),
[Name] varchar (100),
[Description] varchar (255)
);
CREATE TABLE [StationItems] (
[StationId] varchar (100) NOT NULL,
[MediaKey] varchar (100) NOT NULL,
[ItemIndex] int
);
Quite simply, I need the ability to map Stations to a list of one or more StationItems, but I'd like my domain model to return Songs as a Child of Stations. All Songs are mapped elsewhere for save/update purposes, and I just need to have the ability to do an add/lookup for Stations in this context.
Here are my classes (at least the two that I'm struggling with):
Code:
public partial class StationInfoType {
private string membershipIdField;
private string stationIdField;
private string nameField;
private string descriptionField;
private StationItemsDetailType stationItemField;
/// <remarks/>
public string MembershipId {
get {
return this.membershipIdField;
}
set {
this.membershipIdField = value;
}
}
/// <remarks/>
public string StationId {
get {
return this.stationIdField;
}
set {
this.stationIdField = value;
}
}
/// <remarks/>
public string Name {
get {
return this.nameField;
}
set {
this.nameField = value;
}
}
/// <remarks/>
public string Description {
get {
return this.descriptionField;
}
set {
this.descriptionField = value;
}
}
public StationItemsDetailType Songs
{
get
{
return this.stationItemField;
}
set
{
this.stationItemField = value;
}
}
}
public partial class StationItemsDetailType
{
private string idField;
private string stationIdField;
private IList<SongInfoType> songField = new System.Collections.Generic.List<SongInfoType>();
public string Id
{
get
{
return this.idField;
}
set
{
this.idField = value;
}
}
public string StationId
{
get
{
return this.stationIdField;
}
set
{
this.stationIdField = value;
}
}
/// <remarks/>
[XmlIgnore]
public IList<SongInfoType> Song
{
get
{
return this.songField;
}
set
{
this.songField = value;
}
}
[XmlElement("Song")]
public System.Collections.Generic.List<SongInfoType> DoNotUse_SerializedSong
{
get
{
IList<SongInfoType> genericList = new List<SongInfoType>();
foreach (SongInfoType o in this.songField)
genericList.Add(o);
return genericList as List<SongInfoType>;
}
set
{
this.songField = value;
}
}
}
I have to believe that this is relatively simple -- any ideas/help would be greatly appreciated.