Where do you define the mapping for Employee property in BaseAddressMapping?


On Fri, Apr 19, 2013 at 10:19 PM, Peter Forstmeier <
[email protected]> wrote:

> Hi List,
> i have no idea what's wrong with this mapping.
>
>
> public EmployeeMapping()
> {
> ........
> HasMany(x => x.Addresses).Not.LazyLoad();
>
> }
>
> public class BaseAdressMapping : ClassMap<Address>
> {
>         public BaseAdressMapping()
>         {
>             Table("InheritedAddresses");
>             Id(x =>
>
> x.Id).GeneratedBy.GuidComb().UnsavedValue("00000000-0000-0000-0000-000000000000");
>             Map(x =>
> x.ZipCode).Length(DefaultFieldDescription.DefaultIdLength);
>             Map(x =>
> x.Town).Length(DefaultFieldDescription.DefaultStringColumnLength);
>             Map(x =>
> x.AddressLine1).Length(DefaultFieldDescription.DefaultStringColumnLength);
>             Map(x =>
> x.Country).Length(DefaultFieldDescription.DefaultStringColumnLength);
>
>       }
>   }
>
> [Test]
> public void Employee()
> {
>         var factory = MySQLiteSessionFactory.CreateSessionFactory();
>                         var adr1 = new Address() {
>                                 ZipCode = "aa"
>                         };
>
> var adr2 = new Address() {
>                         ZipCode = "aa"
>                        };
>
>                         var list =  new
> System.Collections.Generic.List<Address>();
>                         list.Add(adr1);
>                         list.Add(adr2);
>
>
>
> PersistenceSpecification<ProjectTracker.Domain.Employees.Employee>(factory.OpenSession())
>
>                 .CheckProperty(c => c.CreatedAt, DateTime.Today)
>                 .CheckList(c => c.Addresses,list)
>
>                 VerifyTheMappings();
> }
>
> The table's are created:
> create table InheritedAddresses (
>         Id UNIQUEIDENTIFIER not null,
>        ZipCode TEXT,
>        Town TEXT,
>        AddressLine1 TEXT,
>        Country TEXT,
>        Employee_id UNIQUEIDENTIFIER,
>        primary key (Id),
>        constraint FK1452CB75BF9AA6F3 foreign key (Employee_id)
> references Employees
>     )
>
> NHibernate.Exceptions.GenericADOException : could not insert
> collection:
> [ProjectTracker.Domain.Employees.Employee.Addresses#b0fd8b90-7a2d-4283-
> abf9-a1a5011ae0d5][SQL: UPDATE InheritedAddresses SET Employee_id =
> @p0 WHERE Id = @p1]
>   ----> System.Data.SQLite.SQLiteException : SQLite error
> no such column: Employee_id
>
> Any idea's
> Thanks
> 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.
>
>
>


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


Reply via email to