0
ねえ、 私は次のエンティティをマッピングする必要があります。NHibernateは - マッピング、接続テーブル&後方参照
class Document
{
public int DocumentId { get; set; }
public DocumentList ContainingList { get; set; }
}
class DocumentList
{
public int DocumentListId { get; set; }
public DateTime LastUpdateTime { get; set; }
public IList<Doucment> Documents { get; set; }
}
だけ DocumentListが集・altough特定の文書を(所有することができ、制約付きテーブルはここにあります)。
マッピング(簡単のため、変更することはできません)次の表に頼ることがあります。
TB_DOC
------
DOC_ID (int, PK)
DOC_CONTENT (blob)
TB_DOC_LIST
-----------
DOC_LIST_ID (int, PK)
DOC_LIST_UPDATE_TIME (datetime)
TB_LIST_AND_DOCS
----------------
DOC_LIST_ID
DOC_ID
だから、私はtohughtマッピングは次のようになります:
そして、:
<class name="Document" table="TB_DOC">
<id name="DocumentId">
<column name="DOC_ID"/>
<generator class="assigned" />
</id>
[ ??? ] - property to reference the "owner" document list
</class>
は今、既知のパターンを次のように、私はどのようにすべきでバックリンクを把握することはできませんドキュメントからドキュメントリストへのマッピングは、私は "weired |ここでは1対多の関係であり、3番目の表で壊れています。 また、各Documentはそのような「owner」DocumentListを1つしか持たないので、DocumentオブジェクトがIListを参照して、多対多を逆参照してこれを解決することも望ましくありません。 優雅なアイデアはありますか?私はここで何を誤認しているのですか?