Hello, i've got a problem with inheritance and mapping-by-code. I created a simple class structure which gets compiled to the following (see below). The problem is that i cannot compile because it tells me:
SetUp : NHibernate.MappingException : Could not compile the mapping document: mapping_by_code ----> NHibernate.MappingException : Cannot extend unmapped class: NHibernateTests.Domain.Contact If i remove the class "OrderItem" (which has nothing to do with the rest) the whole thing compiles correctly. I'm hunting down this problem since many hours now, but i've got no solution. Even reordering the "addMapping' calls has no effect. Thanks! -- Contact -- <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" namespace="NHibernateTests.Domain" assembly="NHibernateTests" xmlns="urn:nhibernate-mapping-2.2"> <class entity-name="Contact" name="Contact"> <id name="Id" column="id" type="Int32"> <generator class="hilo"> <param name="max_low">100</param> </generator> </id> <property name="FirstName" column="firstname" not-null="true" /> <property name="LastName" column="secondname" not-null="true" /> </class> </hibernate-mapping> -- Voucher -- <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" namespace="NHibernateTests.Domain" assembly="NHibernateTests" xmlns="urn:nhibernate-mapping-2.2"> <class name="Voucher"> <id name="Id" column="id" type="Int32"> <generator class="hilo"> <param name="max_low">100</param> </generator> </id> <discriminator /> <property name="Number" column="number" /> </class> </hibernate-mapping> -- OrderItem -- <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" namespace="NHibernateTests.Entities" assembly="NHibernateTests" xmlns="urn:nhibernate-mapping-2.2"> <class name="OrderItem"> <id name="Id" column="orderid" type="Int32"> <generator class="hilo"> <param name="max_low">100</param> </generator> </id> <property name="OrderIndex" column="orderindex" /> </class> </hibernate-mapping> -- Order extends Voucher -- <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" namespace="NHibernateTests.Domain" assembly="NHibernateTests" xmlns="urn:nhibernate-mapping-2.2"> <subclass name="Order" extends="Voucher" /> </hibernate-mapping> <?xml version="1.0" encoding="utf-8"?> -- Customer extends Contact -- <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" namespace="NHibernateTests.Domain" assembly="NHibernateTests" xmlns="urn:nhibernate-mapping-2.2"> <joined-subclass entity-name="Customer" name="Customer" extends="Contact"> <key column="customer_key" /> <property name="Number" column="customernumber" not-null="true" /> </joined-subclass> </hibernate-mapping> -- 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.
