Hello hope someone can help me on this.
I have a situation where I have: User entity which stores all my users including admins. Comments entity which stores all comment against users.
my problem is I'm also storing within the comment entity the user id of the admin who made the comment. So now I have the Comment entity having 2 userId fields and when retrieving a User entity it wouldn't fetch any associating comments.
My mapping code is as below:
Within the User Entity..
<set name="MemberComments" cascade="all-delete-orphan" inverse="true">
<key column="UserCommentId"/>
<one-to-many class="IlluminatiCoreUserComment"/>
</set>
Within the UserComment Entity
<id name="UserCommentId">
<generator class="identity"/>
</id>
<many-to-one name="User" class="IlluminatiCoreMember" column="UserId" not-null="true"/>
<property name="Comment" not-null="true"/>
<property name="CreatedTimeStamp" not-null="true"/>
<property name="ModifiedTimeStamp" not-null="true"/>
<many-to-one name="CommentedByUser" class="IlluminatiCoreMember" column="CommentedByUserId" not-null="true" inverse="false"/>
How can I make MemberComments within the User entity point to just the User many-to-one field?
Thanks for your help in advance