I have three tables:
- Person
- User
- PersonSecret
where PersonSecret refers to the person and user:
<class name="PersonSecret" table="PersonSecret" lazy="false" >
<id name="Id" column="Id" type="Guid">
<generator class="assigned"/>
</id>
...
<many-to-one name="Person" class="Person" foreign-key="FK_Person_PersonSecret" lazy="proxy" fetch="select">
<column name="PersonId"/>
</many-to-one>
<many-to-one name="User" class="User" foreign-key="FK_User_PersonSecret" lazy="proxy" fetch="select">
<column name="UserId"/>
</many-to-one>
This is a mapping from User to PersonSecret:
<set name="PersonSecrets" lazy="true" inverse="true" cascade="save-update" >
<key>
<column name="UserId"/>
</key>
<one-to-many class="PersonSecret"/>
And this is from Person to PersonSecret:
<set name="PersonSecrets" lazy="true" inverse="true" cascade="save-update" >
<key>
<column name="PersonId"/>
</key>
<one-to-many class="PersonSecret"/>
Now I am trying to select all persons who have an entry in PersonSecret for a specific user:
var query = this.Session.CreateQuery(@"from Person a inner join PersonSecret b
where b.UserId = :userId and b.RemindeBirthday = :remind");
Now this gives me an ExceptionMessage: "The path expected to connect"
Can someone help me what am I doing wrong? - Thank.
source
share