#
jmaynor
I buy into the benefits of using NHibernate. But I am having an impossible time getting even the most simple NHibernate tasks to complete sucessfully.
I created a demo app (Winform) called MusicTracker, based loosely on Hibernate : A Developer's Notebook application.
In it there is an Album class and an Track Class. I am attempting to make Album -> Track be a 1 -> Many relationship. I have the Album class implementing Tracks as an IList (arraylist internally). When I attempt to save an album:
Dim whosAfraid As New Album("Who's afraid of the Art of Noise?", #1/1/1997#)
Dim t1 As New Track("Peter Gunn", 123)
whosAfraid.Tracks.Add(t1)
t1 = New Track("Who's afraid?", 90)
whosAfraid.Tracks.Add(t1)
AlbumProvider.SaveAlbum(whosAfraid)
I get an ADO.Net error:
Message "Cannot insert the value NULL into column 'Album_ID', table 'MusicTracker.dbo.Track'; column does not allow nulls. INSERT fails.
The statement has been terminated." String
Can comeone take a look at the app and help me understand this simple mapping?
All of the source code and a bak file are available at: http://www.jamaynor.com/1/MusicTracker.zip
Thanks in advance.
Jeremy A Maynor
I created a demo app (Winform) called MusicTracker, based loosely on Hibernate : A Developer's Notebook application.
In it there is an Album class and an Track Class. I am attempting to make Album -> Track be a 1 -> Many relationship. I have the Album class implementing Tracks as an IList (arraylist internally). When I attempt to save an album:
Dim whosAfraid As New Album("Who's afraid of the Art of Noise?", #1/1/1997#)
Dim t1 As New Track("Peter Gunn", 123)
whosAfraid.Tracks.Add(t1)
t1 = New Track("Who's afraid?", 90)
whosAfraid.Tracks.Add(t1)
AlbumProvider.SaveAlbum(whosAfraid)
I get an ADO.Net error:
Message "Cannot insert the value NULL into column 'Album_ID', table 'MusicTracker.dbo.Track'; column does not allow nulls. INSERT fails.
The statement has been terminated." String
Can comeone take a look at the app and help me understand this simple mapping?
All of the source code and a bak file are available at: http://www.jamaynor.com/1/MusicTracker.zip
Thanks in advance.
Jeremy A Maynor