Well, I'm trying to implement unidirectional associations with join tables (one-to-many)
and getting erorr:
System.Xml.Schema.XmlSchemaException: The 'unique' attribute is not declared.
since nHibernate reference chapter for unidirectional associations with join tables is not ready yet, I'm following common Hibernate reference for Java...
http://www.hibernate.org/hib_docs/v3/re ... l-join-12m
my mappings are almost exaclty the same:
XML mappings:
Code:
<class name="Test1.DUser,Test1" table="Users">
<id name="UId" column="Id" type="int">
<generator class="increment"/>
</id>
<property name="UName" column="Name" type="String" length="40"/>
<property name="UPassword" column="Pass" type="String" length="20"/>
<property name="UEmail" column="Email" type="String" length="40"/>
<bag name="Emails" table="UserEmails">
<key column="uID"/>
<many-to-many column="ID" unique="true" class="Test1.UDirectory,Test1"/>
</bag>
</class>
<class name="Test1.UDirectory,Test1" table="Dirs">
<id name="DId" column="ID" type="int">
<generator class="increment"/>
</id>
<property name="DName" column="Name" type="String" length="40"/>
<property name="DLevel" column="Level" type="String" length="5"/>
<property name="DParent" column="Parent" type="String" length="5"/>
<property name="UserId" column="uID" type="String" length="20"/>
</class>
tables:
Code:
CREATE TABLE Users (
ID nvarchar(20) NOT NULL PRIMARY KEY,
Name nvarchar(40) default NULL,
Pass nvarchar(20) default NULL,
Email nvarchar(40) default NULL,
);
CREATE TABLE UserEmails (
uID nvarchar(20) NOT NULL,
ID nvarchar(20) NOT NULL primary key
);
CREATE TABLE Dirs (
ID nvarchar(20) NOT NULL PRIMARY KEY,
Name nvarchar(40) default NULL,
Level nvarchar(5) default NULL,
Parent nvarchar(5) default NULL,
uID nvarchar(20) NOT NULL
);
So, any ideas what unique attribute is not declared yet ?