|
i have a simple table:
document_id
user_name
I want to create a class that has attribute mappings. This table does not have a unique ID field. The UNIQUE Constraint is document__id and user_name together. Can someone please help me with this attributes mapping? Thank you very much in advance. Here is what I have. It does not work...
namespace InboundModel
{
[NHibernate.Mapping.Attributes.Class(Table = "USER_IGNORED_DOCS")]
public class UserIgnoredDocs
{
private int _inboundDocsId;
private string _inboundUserName;
/// <summary> Gets/Sets InboundDocsID. </summary>
[NHibernate.Mapping.Attributes.CompositeId(1)]
[NHibernate.Mapping.Attributes.KeyProperty(2, Name = "InboundDocsId", Column = "INBOUND_DOCS_ID")]
[NHibernate.Mapping.Attributes.KeyProperty(3, Name = "InboundUserName", Column = "USER_IGNORED_DOCS", Access = "property")]
public virtual int InboundDocsId
{
get { return _inboundDocsId; }
set { _inboundDocsId = value; }
}
/// <summary> Inbound User Name. </summary>
[NHibernate.Mapping.Attributes.Property(NotNull = false, Column = "INBOUND_USER_NAME")]
public virtual string InboundUserName
{
get { return _inboundUserName; }
set { _inboundUserName = value; }
}
}
}
the exception I get is:
NHibernate.MappingException: Could not compile the mapping document:(unknown) --> NHibernate.MappingException: composite-id class must override Equals();
|