I think he might want to create the DB schema using SchemaExport class.
On Thu, Apr 25, 2013 at 2:53 PM, Pete Appleton <[email protected]>wrote: > Everything there is fine, but whatever DB is being accessed doesn't have > the right schema. Please paste your DB config, make sure your factory is > accessing the DB in which you created the tables. > > -----Original Message----- > From: [email protected] on behalf of Peter Forstmeier > Sent: Thu 4/25/2013 7:33 AM > To: nhusers > Subject: [nhusers] Re: Wrong Mapping > > Hi, > i did the test as follows: > [Test] > public void EmployeeMapping() > { > var factory = > MySQLiteSessionFactory.CreateSessionFactory(); > var employee = new > ProjectTracker.Domain.Employees.Employee() { > CreatedBy ="me", > CreatedAt = DateTime.Today, > EmployeeId = "10" > }; > > var address1 = new EmployeeAddress(); > address1.CreatedBy ="me"; > address1.CreatedAt = DateTime.Today; > address1.Address = new Address() { > ZipCode = "88161" > }; > address1.Employee = employee; > > var addressList = new > System.Collections.Generic.List<EmployeeAddress>(); > > addressList.Add(address1); > // employee.Addresses = addressList; > new > > PersistenceSpecification<ProjectTracker.Domain.Employees.Employee>(factory.OpenSession()) > > /* > .CheckProperty(c => c.CreatedAt, > DateTime.Today) > .CheckProperty(c => c.UpdatedAt, > DateTime.Today) > .CheckProperty(c => c.CreatedBy, > WindowsIdentity.GetCurrent().Name) > .CheckProperty(c => c.EmployeeId, "10") > .CheckProperty(c => c.HoursPerWeek, > Convert.ToDouble(40.5)) > .CheckProperty(c => c.HireDate, > DateTime.Today) > */ > .CheckProperty(c => c.CreatedAt, > employee.CreatedAt) > .CheckProperty(c => c.UpdatedAt, > DateTime.Today) > .CheckProperty(c => c.CreatedBy, > employee.CreatedBy) > .CheckProperty(c => c.EmployeeId, > employee.EmployeeId) > .CheckProperty(c => c.HoursPerWeek, > Convert.ToDouble(40.5)) > .CheckProperty(c => c.HireDate, > DateTime.Today) > .CheckList(c => > c.Addresses,employee.Addresses) > .VerifyTheMappings(); > } > NHibernate: INSERT INTO Employees (Version, CreatedAt, CreatedBy, > UpdatedAt, UpdatedBy, EmployeeId, Firstname, Lastname, HoursPerWeek, > BirthDate, HireDate, SickDays, VacationDays, Salutation_id, Id) VALUES > (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, > @p13, @p14);@p0 = 1 [Type: Int32 (0)], @p1 = 25.04.2013 08:31:00 > [Type: DateTime (0)], @p2 = 'FORSTMEIER\Peter Forstmeier' [Type: > String (0)], @p3 = NULL [Type: DateTime (0)], @p4 = NULL [Type: String > (0)], @p5 = '10' [Type: String (0)], @p6 = NULL [Type: String (0)], > @p7 = NULL [Type: String (0)], @p8 = 0 [Type: Double (0)], @p9 = NULL > [Type: DateTime (0)], @p10 = NULL [Type: DateTime (0)], @p11 = 0 > [Type: Int32 (0)], @p12 = 0 [Type: Int32 (0)], @p13 = NULL [Type: > Int32 (0)], @p14 = e05d2d11-d224-4f40-8885-a1ab008c5aae [Type: Guid > (0)] > > NHibernate: INSERT INTO InheritedAddresses (ZipCode, Town, > AddressLine1, Country, Id) VALUES (@p0, @p1, @p2, @p3, @p4);@p0 = > '88161' [Type: String (0)], @p1 = NULL [Type: String (0)], @p2 = NULL > [Type: String (0)], @p3 = NULL [Type: String (0)], @p4 = > 392b2313-115b-49d0-aeb1-a1ab008c5ab2 [Type: Guid (0)] > > NHibernate: INSERT INTO EmployeeAddresses (Version, CreatedAt, > CreatedBy, UpdatedAt, UpdatedBy, AddressType, EmployeeId, AddressId, > Id) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8);@p0 = 1 > [Type: Int32 (0)], @p1 = 25.04.2013 00:00:00 [Type: DateTime (0)], @p2 > = 'me' [Type: String (0)], @p3 = 25.04.2013 08:31:00 [Type: DateTime > (0)], @p4 = 'FORSTMEIER\Peter Forstmeier' [Type: String (0)], @p5 = > 'Home' [Type: String (0)], @p6 = e05d2d11-d224-4f40-8885-a1ab008c5aae > [Type: Guid (0)], @p7 = 392b2313-115b-49d0-aeb1-a1ab008c5ab2 [Type: > Guid (0)], @p8 = 0832ed14-5d69-4521-8e8d-a1ab008c5aa9 [Type: Guid (0)] > > ) Test Error : > ProjectTracker.Test.Mappings.EmployeeMappingsFixture.EmployeeMapping > NHibernate.Exceptions.GenericADOException : could not insert: > [ProjectTracker.Domain.Employees.EmployeeAddress#0832ed14-5d69-4521-8e8d- > a1ab008c5aa9][SQL: INSERT INTO EmployeeAddresses (Version, CreatedAt, > CreatedBy, UpdatedAt, UpdatedBy, AddressType, EmployeeId, AddressId, > Id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] > ----> System.Data.SQLite.SQLiteException : SQLite error > no such table: EmployeeAddresses > > > I try the commented part as well > Peter > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/nhusers?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/nhusers?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Maximilian Haru Raditya -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
