Hello,

I am trying to map a one-to-one relationship between two classes. I
believe the problem is that I want the primary key of the associated
class to be the mapping property. My classes are like this
(simplified):

public class A
{
    public virtual Int32 Id { get; set; }
}

public class B
{
    public virtual A { get; set; }
}

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="NHibernateTeste" assembly="NHibernateTeste" auto-
import="true" default-access="property">
  <class name="A" table="A" lazy="false">
    <id name="Id" column="ID">
      <generator class="assigned"/>
    </id>
    <one-to-one name="B" property-ref="A"/>
  </class>
</hibernate-mapping>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="NHibernateTeste" assembly="NHibernateTeste" auto-
import="true" default-access="property">
  <class name="B" table="B" lazy="false">
    <composite-id name="A">
      <key-many-to-one name="Id" class="A" lazy="false"/>
    </composite-id>
    <many-to-one name="A" lazy="false" unique="true"/>
  </class>
</hibernate-mapping>

I get an SQL error saying that column A does not exist on table B.

Can you help?

Thanks,

Ricardo Peres

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

Reply via email to