[ http://216.121.112.228/browse/NH-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fabio Maulo closed NH-1270.
---------------------------
Resolution: Obsolete
<class name="User">
<id name="Id" type="Guid">
<generator class="guid" />
</id>
<property name="Name" />
<set name="Roles" table="UsersToRoles" inverse="true">
<key column="UserId" />
<many-to-many class="Role" column="RoleId" foreign-key="FK_RoleInUser" />
</set>
</class>
<class name="Role">
<id name="Id" type="Guid">
<generator class="guid" />
</id>
<property name="Name" />
<set name="Users" table="UsersToRoles">
<key column="RoleId" />
<many-to-many class="User" column="UserId" foreign-key="FK_UserInRole" />
</set>
</class>
Creates this schema:
create table [User] (
Id UNIQUEIDENTIFIER not null,
Name NVARCHAR(255) null,
primary key (Id)
)
create table UsersToRoles (
UserId UNIQUEIDENTIFIER not null,
RoleId UNIQUEIDENTIFIER not null,
primary key (RoleId, UserId)
)
create table [Role] (
Id UNIQUEIDENTIFIER not null,
Name NVARCHAR(255) null,
primary key (Id)
)
alter table UsersToRoles
add constraint FK_RoleInUser
foreign key (RoleId)
references [Role]
alter table UsersToRoles
add constraint FK_UserInRole
foreign key (UserId)
references [User]
Test available in NHibernate.Test.NHSpecificTest.NH1270
> SchemaExport using foreign key name for 'inverse' side of ManyToMany
> --------------------------------------------------------------------
>
> Key: NH-1270
> URL: http://216.121.112.228/browse/NH-1270
> Project: NHibernate
> Issue Type: Improvement
> Components: Toolset
> Affects Versions: 2.1.0.Alpha1
> Reporter: Fried Hoeben
> Priority: Minor
>
> At the moment one can specifiy a foreign key name (using NHibernate attributes) for the side of a ManyToMany relation marked as inverse. But this name is not used by SchemaExport, instead of foreign key with a generated name is created.
> Please change this behavior to use the name provided, instead of generating a key name.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|