NHibernate version: 1.0.0
Mapping documents:
<bag name="channels" table="CHANNELS2PLANNED_BROADCASTS" order-by="CHANNELS_FK" inverse="false">
<key foreign-key="CHANNEL_PLANNED_BROADCASTS_FKC">
<column name="PLANNED_BROADCASTS_FK" />
</key>
<many-to-many class="xxx.Channel, xxx" foreign-key="PRESENTATION_CHANNELS_FKC">
<column name="CHANNELS_FK" />
</many-to-many>
</bag>
<joined-subclass name="xxx.ScheduleRule, IQuality.FutureCast" table="SCHEDULE_RULE" dynamic-insert="false" dynamic-update="false">
Code between sessionFactory.openSession() and session.close():
Session.find(pHql);
Hello,
i've have some problems with NHibernate with builder my hql-queries.
1) I want to select all Presentations with had a relation with a specific Channel. Presentation an Channel have a many-to-many relation. But it won't work :(
I can't call the Channel directly, like: from Presentation presentation where presentation.channels.id = 1.
I also tried a join: from Presentation presentation inner join presentation.channels where channel.id = 1.
I can't/won't use an ICritera, because this is a part of a query.
2) I want to get alle specialisations of a association. ScheduleRule extends Rule and Presentation has a one-to-many relation with Rule.
I tried this, wich stands in my Hibernate book "professional hibernate":
from Rule rule where rule.class = ScheduleRule
I doesn't give an exception, but only an empty list. But there are ScheduleRules! This was an example with Hibernate (java), but it won't work in NHibernate.
Can someone help me with these queries?
|