moonshi
unread,Aug 12, 2011, 11:34:56 AM8/12/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nhu...@googlegroups.com
Hi:
I am very new to this forum and a rookie using NHibernate.
We came up with a situation recently and I would appreciate someone's help in that.
We have two entities having parent-child relation. Here are the corresponding HBMs.
<class name="MainCandidate" table="mainCandidates" dynamic-update="true" >
<id name="Id" column="TheName" type="string" unsaved-value="null">
<generator class="assigned"/>
</id>
<bag name="Steps" lazy="true" cascade="all-delete-orphan" order-by="stepOrder" inverse="true" >
<key column="TheName" />
<one-to-many class="Step" />
</bag>
</Class>
<class name="Step" table="tbl_step_key">
<many-to-one column="TheName" name="Rule" class="MainCandidate" cascade="none" />
</Class>
Whenever MainCandidate object is loaded, 'Step' table will be loaded
lazily. 'TheName' is happened to be the primary key on 'MainCandidate'
table and foreignkey on 'Step' table.
Due to our recent data migration to 'MainCandidate' table, some of
'TheName' column values are updated with trailing spaces and it went
unnoticed. Recently we found out that the NHibernate query which is
reponsible for loading the child 'Step' table is messed up because of
that trailing spaces. We've traced that query through SQL Profiler.
My question is, is there anyway that we correct this problem without
touching either of the above mentioned tables? How can we make the
NHibernate query ignore the whitespaces?
Thanks inadvance.