TABLE BOOKING (
BOOK_ID
PERSONAL_ID
ORGINIZER
TITLE
PRIMARY KEY ( BOOK_ID )
FOREIGN KEY ( PERSONAL_ID)
);
TABLE PERSONAL
(
ID
NAME
SURNAME
EMAIL
PRIMARY KEY (ID)
);
我的问题是如何映射个人表?我的问题是个人没有外键,所以我不知道如何映射个人。我需要从该表中获取 NAME、SURNAME 和 EMAIL。
希望有人可以提供帮助。
到目前为止,我的映射看起来像这样:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Depp.Domain.Booking, Depp.Core" >
<id name="ID" unsaved-value="0" column="ID">
<generator class="native">
<!--<param name="sequence">GLOBALSEQUENCE</param>-->
</generator>
</id>
<property name="Title" ></property>
<property name="TitleEnabled" type="yes_no">
<column name="THEMA_ENABLED"/>
</property>
<property name="ORGANIZER" column="PERSONAL_ID" not-null="true" ></property>
<many-to-one name="Personal" class="Book.Domain.Booking, Book.Core" column="Personal_ID"
not-null="true" />
</class>
<class name="Book.Domain.Personal, Book.Core">
<id name="id" column="ID">
<generator class="native"/>
</id>
<component name="Booker" class="Book.Domain.Person, Book.Core">
<property name="Name" column="NN" />
<property name="Surname" column="VN"/>
<property name="Email" column="EMAIL" />
<property name="Phone" column="TEL" />
</component>
</class>
</hibernate-mapping>
如果我使用多对一关系,网站就会崩溃。