Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: NHibernate 1.2 Beta 2
Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MyAssembly.Domain.EntityA, MyAssembly.Domain" table="tblEntityA" lazy="true">
<id name="EntityAID" column="EntityAID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<property name="Name" column="EntityAName"/>
<one-to-one name="EntityB" class="MyAssembly.Domain.EntityB, MyAssembly.Domain" property-ref="EntityA" constrained="true" lazy="proxy" />
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MyAssembly.Domain.EntityB, MyAssembly.Domain" table="tblEntityB" lazy="true">
<id name="EntityBID" column="EntityBID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<many-to-one name="EntityA" class="MyAssembly.Domain.EntityA, MyAssembly.Domain" column="EntityAID" lazy="proxy" />
<property name="Message" column="EntityBMessage"/>
</class>
</hibernate-mapping>
Name and version of the database you are using: SQL Server 2000
Hi all,
I've got a really frustrating issue. Basically I have a DB entity mapping of
EntityA (1:M) EntityB but I want it to work as a pseudo 1:1 because that is the actual use, e.g. EntityAID is unique in table EntityB.
My problem is that whenever I do a select for EntityA, even with an eager fetch for EntityB then it always does a seperate select for EntityB. I've tried every combination of lazy load, outerjoin, constrained etc. etc. I can think of but no matter what I do EntityB is always got in a seperate select when I select EntityA, even when I don't access the EntityB property of EntityA.
Is there an answer? This is the only thing now really stopping me using this for a port of our company app and it is so frustrating I can't work it out. This is an existing DB so I can't really change the schema as I did to maintain two seperate apps of the same DB.
Many thanks
Stuart Jones