Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.0.1.GA
Mapping documents: Attributes
Code between sessionFactory.openSession() and session.close():
ContactAddressEntity ent = session.Get<ContactAddressEntity>( 25L );
Console.WriteLine( "{0}, {1}", ent.AddressID.ID, ent.AddressID.GetType( ).Name );
Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
SQL Server 2008
I have a ContactAddressEntity with a many-to-one mapping to AddressEntity on the AddressID property of ContactAddressEntity.
Address has a subclass called AKAddressEntity.
If I map AddressID with Lazyness.Proxy I always get an AddressEntityProxy type for the AddressID property. This happens regardless of the descriminator value of the target row. Thus I cannot get to the properties of the AKAddressEntity.
If I map AddressID with Lazyness.False (that being the only change to the mapping) I get the correct AKAddressEntity as expected when the target row contains the discriminator value for AKAddressEntity. Furthermore I also get AddressEntity type when the discriminator value is the default specified for AddressEntity.
So Eager many-to-one associations to table-per-class hierarchy types function as expected. Lazy associasions do not.
Is there any way to get this to work?