Thanks for the quick reply...  I've added the bi-directional relationship
between Subscription -0...*- SubscriptionDefinition and have a mapping test
that proves it works.
Below is the PersistenceSpecification version of a mapping test that is
failing with the following message:
It appears as though I don't have the relationship between the collection
and the parent.
What do I need to do in order to have this work?  Thanks again..

I thought I followed the pattern for this type of test based on the blogs I
saw...

NHibernate:
 INSERT INTO dbo.[SubscriptionDefinition] (LastModifiedDate, Version,
CreateBy, CreateDate, LastModifiedBy, SubscriptionId) VALUES (@p0,
@p1, @p2, @p3, @p4, @p5);
select SCOPE_IDENTITY(); @p0 = '2009/03/25 10:44:30 AM', @p1 = '1',
@p2 = 'gcook', @p3 = '2009/03/25 10:44:30 AM',
@p4 = 'gcook', @p5 = ''

System.Data.SqlClient.SqlException:
Cannot insert the value NULL into column 'SubscriptionId', table
'xxx.dbo.SubscriptionDefinition'; column does not allow nulls. INSERT
fails
.
The statement has been terminated.

[Test]
        public void SubscriptionWithSubscriptionDefinitions()
        {
            var definitions =
                new List<SubscriptionDefinition>
                    {

 ObjectMother.CreateMessagingSubscriptionDefinition("foo"),

 ObjectMother.CreateMessagingSubscriptionDefinition("bar"),

 ObjectMother.CreateMessagingSubscriptionDefinition("another 1")
                    };
            new PersistenceSpecification<Subscription>(session)
                .CheckProperty(x => x.Name, "Apple")
                .CheckProperty(x => x.ContactEmailAddress, "
myemailaddresss.com")
                .CheckList(x => x.SubscriptionDefinitions, definitions)
                .VerifyTheMappings();
        }

//THIS TEST WORKS
[Test]
        public void CanHaveSubscriptionDefinitions()
        {
            Subscription subscription =
ObjectMother.CreateSubscription("mySub").Save<Subscription>();

 subscription.Add(ObjectMother.CreateMessagingSubscriptionDefinition("Q1"));

 subscription.Add(ObjectMother.CreateMessagingSubscriptionDefinition("Q2"));

 subscription.Add(ObjectMother.CreateMessagingSubscriptionDefinition("Q3"));

            DataSource.Flush().ClearAllCaches();

            Subscription found =
DataSource.FindById<Subscription>(subscription.Id);
            Assert.IsNotNull(found);
            Assert.AreEqual(3, found.SubscriptionDefinitions.Count);

            foreach (SubscriptionDefinition each in
subscription.SubscriptionDefinitions)
            {
                Assert.IsTrue(found.SubscriptionDefinitions.Contains(each));
            }
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to