Ok, I've fixed it. Your change was correct, but I've also modified the main
program code a bit too. I was reusing the session and just creating another
transaction, so the session cache must have been interfering with the query.
I've updated it to create a new session for the querying.

On Wed, Mar 25, 2009 at 9:24 AM, James Gregory <[email protected]>wrote:

> Actually, I stand corrected. There's obviously some kind of caching going
> on, because when I run it the Employees are retrieved by the Criteria query,
> but they're not actually in the table. Bizarre.
>
> On Wed, Mar 25, 2009 at 9:18 AM, James Gregory <[email protected]>wrote:
>
>> What database were you using? We've had this reported before but when I
>> run it against SQLite everything saves.
>>
>>
>> On Wed, Mar 25, 2009 at 3:57 AM, devSolo <[email protected]> wrote:
>>
>>>
>>> I've been playing around with Fluent NHibernate tonight and I'm liking
>>> it very much.  I just thought I'd let you guys know of a small issue I
>>> noticed while working through the FirstProject example.
>>>
>>> # program.cs
>>> # 55       // save both stores, this saves everything else via
>>> cascading
>>> # 56      session.SaveOrUpdate(barginBasin);
>>> # 57      session.SaveOrUpdate(superMart);
>>> # 59      transaction.Commit();
>>>
>>> I expected all 3 entities to be saved to the DB.  But only the Stores
>>> and Products actually got persisted. The sample doesn't actually save
>>> the Employees to the db.  Check the DB after a run and you will see,
>>> or you can close the session and reopen it before the reads.
>>>
>>> In the constructor for StoreMap ...
>>>
>>> # Mappings/StoreMap.cs
>>> #<<<<<<SNIPPIT>>>>>>>
>>> #  8      public StoreMap()
>>> #  9      {
>>> # 10          Id(x => x.Id);
>>> # 11          Map(x => x.Name);
>>> # 12          HasManyToMany(x => x.Products)
>>> # 13              .Cascade.All()
>>> # 14              .WithTableName("StoreProduct");
>>> # 15          HasMany(x => x.Staff)
>>> # 16              .Inverse();
>>> # 17      }
>>> #<<<<<<SNIPPIT>>>>>>>
>>>
>>> I changed line #16 to be:
>>>                     .Cascade.All().Inverse();
>>>
>>> and now it is saving correctly.
>>>
>>> I know this is very basic thing, but the example should work as
>>> expected.  It did make me think though... and caused me to learn a bit
>>> more about Fluent NHibernate than I would have otherwise.
>>>
>>>
>>> >>>
>>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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