Hi
I'm trying to use query by example on an entity that contains a composite key. If I setup the Key object with the values to be used in the SELECT and then add it to the Entity, NHibernate ignores the values (and attempts to retrieve everything in the table).
I can't use the CreateCriteria.Add( ) method as you do for associations because the key isn't an association.
Can anyone provide an example of how to achieve this?
The code currently looks something like this:
Code:
CountryStateZipLocality example = new CountryStateZipLocality();
example.ID = new CountryStateZipLocalityPK();
example.ID.ZipCode = "2600";
criteria.Add( Example.Create( example ) );
// The following line causes an error as "ID" isn't an association path
criteria.CreateCriteria( "ID" ).Add( Example.Create( example.ID ) );
IList resultsList = criteria.List();
Thanks