Hello all, I'm facing the following problem:

I have two models related as master-detail. I created the mappings with 
NHibernate + Fluent and when I'm querying the detail table I obtain the 
following exception:

NHibernate.Exceptions.GenericADOException was unhandled by user code
  HResult=-2146232832
  Message=Failed to execute multi criteria

(...)

InnerException: NHibernate.PropertyAccessException
       HResult=-2146232832
       Message=Exception occurred getter of (...) Model.Campaign.Campaign.Id
       Source=NHibernate

The PK and FK of both tables are uniqueidentifier MsSQL Server field, in 
the model they are Guid properties and the reference in the mapping is:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentNHibernate.Mapping;
using Repository.NHibernate.Types;
using Model.Campaign;
using Model.Sharable.Enum;
using Model.User;

namespace Model.NHibernate.Campaign
{
    public class CampaignSharingMap: ClassMap<CampaignSharing>
    {
        public CampaignSharingMap()
        {
            Table("lnkCampaignSharing");
            BatchSize(20);

            CompositeId(sharing => sharing.Id)
                .KeyReference(id => id.Campaign, "IDCampaign")
                .KeyProperty(id => id.SharingId, "IDSharing")
                .KeyProperty(id => id.SharingType, "SharingEntity");

            Map(sharing => 
sharing.CreatedDate).Column("CreatedDate").Precision(3).Not.Nullable();
            Map(sharing => sharing.Permissions)
                .Column("Permissions")
                .CustomType<EnumCsvSet<SharingPermission, 
ObjectPermissionConverter>>()
                .Not.Nullable();

*            References(sharing => 
sharing.FromEntity).Class<Model.User.User>().Column("CreatedByID");*
*            References(sharing => 
sharing.Sharable).Class<Model.Campaign.Campaign>().Column("IDCampaign");*
*            ReferencesAny(sharing => sharing.ToEntity)*
*                .EntityIdentifierColumn("IDSharing")*
*                .EntityTypeColumn("SharingEntity")*
*                .IdentityType<int>()*
*                .AddMetaValue<Group>(SharingType.Group.Value)*
*                .AddMetaValue<Model.User.User>(SharingType.User.Value);*
        }
    }
}

Could anyone help me? If you need more information please let me know.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to