I think I've found the problem. In the test fixture, I'm creating a
new randomly names file, but when I call FileTypeRepository.Add(), I
use an NHibernateHelper which uses a database in the application
directory. I need to rethink this...

Thanks again for your help. :)

On Oct 8, 6:00 pm, Jason Dentler <[email protected]> wrote:
> Sorry. Without more data, I'm out of ideas. Send us the NHibernate log4net
> output from just your add method. Maybe that will give us a clue about the
> root of the problem.
> Jason
>
> On Thu, Oct 8, 2009 at 11:56 AM, HJ <[email protected]> wrote:
>
> > Thanks Jason,
> > I'm using a persistent database writing to disk. I use SQLite in my
> > application, and although the test's teardown method deletes the
> > temporary one created by the tests, if I open the temporary database
> > while the test is running I can see the correct table with fields as
> > they should be - the table's just empty.
>
> > On Oct 8, 5:53 pm, Jason Dentler <[email protected]> wrote:
> > > Hi HJ. Are you using the SQLite in-memory database? If so, switch to a
> > disk
> > > file and see if that corrects the problem. When the last connection to a
> > > SQLite in-memory database is closed, the database forgotten. When you
> > > connect to it again, you have a fresh, empty database. I suspect this may
> > be
> > > your problem.
> > > Based on the information you've provided, I don't see any other reason
> > why
> > > this won't work. Can you share your hbm for FileType? Also, have you
> > > examined the NHibernate log output from this section of code? Can you
> > share
> > > that with us?
>
> > > Jason
>
> > > On Thu, Oct 8, 2009 at 11:13 AM, HJ <[email protected]> wrote:
>
> > > > I'm new to NHibernate and am trying to follow the getting started
> > > > guide using SQLLite instead of SQL Server. I've got to the stage where
> > > > the database and table are created (correctly), but I'm trying to add
> > > > a class called FileType, howevere, no row is inserted into the
> > > > database (not being saved). This is my code:
>
> > > > public void Add(FileType fileType) {
> > > >    using(ISession session = NHibernateHelper.OpenSession()) {
> > > >        using(ITransaction trans = session.BeginTransaction()) {
> > > >            session.Save(fileType);
> > > >            trans.Commit();
> > > >        }
> > > >    }
> > > > }
>
> > > > I'm very new to this, so having spent the day getting this far,  I
> > > > don't have any idea what to do to further troubleshoot. Could anyone
> > > > shed some light on this please?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to