Hello,
I have three classes (Employee, Ric, AlarmText) that are linked
together with many-many connections.
Therefor I have five tables:
Employee -> Primary Key: Employee_PK
EmployeeRic -> Employee_FK, Ric_FK
Ric -> PrimaryKey: Ric_PK
AlarmTextRic -> AlarmText_FK, Ric_FK
AlarmText -> PrimaryKey AlarmText_PK
Here the relevant parts of the mapping files:
<class name="Employee" table="Employee" >
<id name="Id" column="Employee_PK" unsaved-value="0" >
<generator class="native" />
</id>
<bag name="Rics" table="RicEmployee" lazy="true" cascade="none"
inverse="true">
<key column="Employee_FK"/>
<many-to-many column="Ric_FK" class="Ric"/>
</bag>
</class>
<class name="Ric" table="Ric" >
<id name="Id" column="Ric_PK" unsaved-value="0" >
<generator class="native" />
</id>
<bag name="Employees" table="RicEmployee" lazy="true" cascade="all"
>
<key column="Ric_FK"/>
<many-to-many column="Employee_FK" class="Employee"/>
</bag>
<bag name="AlarmTexts" table="AlarmTextRic" lazy="true"
cascade="none" inverse="true">
<key column="Ric_FK"/>
<many-to-many column="AlarmText_FK" class="AlarmText"/>
</bag>
</class>
<class name="AlarmText" table="AlarmText">
<id name="Id" column="AlarmText_PK" unsaved-value="0" >
<generator class="native" />
</id>
<bag name="Rics" table="AlarmTextRic" lazy="true" cascade="all">
<key column="AlarmText_FK"/>
<many-to-many column="Ric_FK" class="Ric"/>
</bag>
</class>
When I do a query the generated SQL Query contains the same alias
twice:
SELECT
this_.Employee_PK as Employee1_19_2_,
rics4_.Employee_FK as Employee2_,
ric1_.Ric_PK as Ric1_,
ric1_.Ric_PK as Ric1_11_0_,
alarmtexts6_.Ric_FK as Ric1_,
alarmtext2_.AlarmText_PK as AlarmText2_,
alarmtext2_.AlarmText_PK as AlarmText1_17_1_,
FROM
Employee this_
inner join RicEmployee rics4_ on
this_.Employee_PK=rics4_.Employee_FK
inner join Ric ric1_ on rics4_.Ric_FK=ric1_.Ric_PK
inner join AlarmTextRic alarmtexts6_ on
ric1_.Ric_PK=alarmtexts6_.Ric_FK
inner join AlarmText alarmtext2_ on
alarmtexts6_.AlarmText_FK=alarmtext2_.AlarmText_PK
WHERE alarmtext2_.AlarmText_PK = @p0
The Alias Ric1_ is used twice, once for ric1_.Ric_PK and once for
alarmtexts6_.Ric_FK .
With MS SQL Server this is no problem, but with SQL Compact Edition
this query does not work.
Is this a bug of the NHibernate or is this a problem with my column
names? (As the Database is already in use with this scheme I can't
change the names).
Is there a possibility to change the behaviour of the naming for the
column aliases or what can I do?
Thanks and greetings
Roland
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.