Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
nhibernate 1.0.2.0
I want to map 2 tables (many to many):
CREATE TABLE tUser (
user_id [int] IDENTITY (1, 1) NOT NULL ,
user_name [nvarchar] (50));
CREATE TABLE tGroup (
group_id [int] IDENTITY (1, 1) NOT NULL ,
group_name [nvarchar] (50));
CREATE TABLE tGroup_User (
group_user_id [int] IDENTITY (1, 1) NOT NULL ,
user_key int references tUser(user_id)
group_key int references tGroup(group_id));
so, my problems is, that the name of the primary key in tuser is different
from the foreign key in tGroup_User.
So, how do i map the different names in my idbag?,
do there exists eg. a alias tag?
<class name="Business.Group, nibernate_test" table="tGroup">
<id name="Group_id" column="group_id" access="nosetter.camelcase" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Group_name" column="group_name" />
<property name="Group_comment" column="group_comment" />
<property name="Domain_key" column="domain_key" />
<property name="Site_key" column="site_key" />
<property name="Ou_key" column="ou_key" />
<idbag name="Users" table="tGroup_User" lazy="false">
<collection-id column="group_user_id" type="long">
<generator class="identity"/>
</collection-id>
<key column="group_id"/>
<many-to-many column="user_id" class="User" outer-join="true"/>
</idbag>
</class>