Hello all
I have big problem :(
I can't run HQL with many-to-many relationship
I have 3table:
Article - vw_RelationshipCategories - Category
Article - [man to many] - Category
and 2 object: Article & Category
1. Article
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Model" namespace="Model">
<class name="Article" table="vw_articles">
<id name="ID" type="System.Int32" column="PostId">
<generator class="assigned"/>
</id>
<property name="CategoryId" column="CategoryId" type="System.Int32" />
<property name="Title" column="Title" type="System.String" />
<property name="ClearTitle" column="ClearTitle" type="System.String" />
<property name="Description" column="Description" type="System.String" />
<bag name="Categories" table="vw_relationshipcategories" cascade="none">
<key column="PostId" />
<many-to-many column="CategoryId" class="Category" />
</bag>
</class>
</hibernate-mapping>
2. CategoryCode:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Model" namespace="Model">
<class name="Category" table="vw_categories">
<id name="ID" type="System.Int32" column="CategoryId">
<generator class="assigned"/>
</id>
<property name="Name" column="name" type="System.String" />
<property name="Slug" column="slug" type="System.String" />
<property name="Description" column="description" type="System.String" />
</class>
</hibernate-mapping>
When I run a HQL:
"
from Article a join a.Categories c where c.Slug='bank1x'" <= No result value -> not have bug
"
from Article a join a.Categories c where c.Slug='bank'" <= Have error "Could not execute query"
I don't know why have bug :(
Help me!