I have a unidirectional many to many mapping between two entites Visitor and Stands....i have a lookup table vcfBusinesscards which is used for this mapping.
I need a named query tell me if there are any mappings between a specific visitor and specific stand given there ids.
i tried this:
<query name="Visitor.Bookmarked">from Visitor v where v.BCStands.Code=? and v.Id = ?</query>
but got this error:
NHibernate.QueryException: expecting 'elements' or 'indices' after Code [from vcf.code.entites.users.Visitor v where v.BCStands.Code=? and v.Id = ?]
Visitor Entity:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="vcf.code.entites.users.Visitor,vcf" table="vcfVisitors">
<id name="Id" column="code" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<set name="BCStands" table="vcfBusinessCard">
<key column="visitor_id"/>
<many-to-many column="stand_id" class="vcf.code.entites.Stand,vcf"/>
</set>
</class>
<query name="Visitor.Get">from Visitor where user_code= ?</query>
</hibernate-mapping>
Stand Entity:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="vcf.code.entites.Stand,vcf" table="vcfStands">
<id name="Code" column="code" type="Int32">
<generator class="native"/>
</id>
</class>
</hibernate-mapping>