Also, I found this post, but I'm not sure if the fix was ever put in
place.

http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/4612913df1a4d916/9b07e19ce9e0de9e?lnk=raot



On Dec 16, 3:29 pm, Rob Gibbens <[email protected]> wrote:
> ------ Test started: Assembly: MyCompany.Data.Testing.dll ------
>
> TestCase
> 'MyCompany.Data.Testing.OffersTest.GetOffersWithIncludedApplications'
> failed: TestFixtureSetUp failed in OffersTest
> TestFixture failed:
> Castle.MicroKernel.ComponentActivator.ComponentActivatorException :
> ComponentActivator: could not instantiate MyCompany.Data.NHFactory
>   ----> System.Reflection.TargetInvocationException : Exception has
> been thrown by the target of an invocation.
>   ----> System.NotSupportedException : Can't figure out what the other
> side of the many-to-many property 'Applications' should be.
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInsta 
> nce
> (CreationContext context, Object[] arguments, Type[] signature)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate
> (CreationContext context)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCre 
> ate
> (CreationContext context)
>    at
> Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create
> (CreationContext context)
>    at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve
> (CreationContext context)
>    at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve
> (CreationContext context)
>    at Castle.MicroKernel.Handlers.DefaultHandler.Resolve
> (CreationContext context)
>    at
> Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDepend 
> ency
> (CreationContext context, ComponentModel model, DependencyModel
> dependency)
>    at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve
> (CreationContext context, ISubDependencyResolver
> contextHandlerResolver, ComponentModel model, DependencyModel
> dependency)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConst 
> ructorArguments
> (ConstructorCandidate constructor, CreationContext context, Type[]&
> signature)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate
> (CreationContext context)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCre 
> ate
> (CreationContext context)
>    at
> Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create
> (CreationContext context)
>    at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve
> (CreationContext context)
>    at Castle.MicroKernel.Handlers.DefaultHandler.Resolve
> (CreationContext context)
>    at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
> handler, Type service, IDictionary additionalArguments)
>    at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
> handler, Type service)
>    at Castle.MicroKernel.DefaultKernel.get_Item(Type service)
>    at Castle.Windsor.WindsorContainer.Resolve(Type service)
>    at Castle.Windsor.WindsorContainer.get_Item(Type service)
>    at MyCompany.Toolkit.Reflection.ObjectFactory.Create[T](Boolean
> isErrorThrown) in C:\Development\dev\Toolkit\Toolkit.Shared\Reflection
> \ObjectFactory.cs:line 124
>    at MyCompany.Toolkit.Reflection.ObjectFactory.Create[T]() in C:
> \Development\dev\Toolkit\Toolkit.Shared\Reflection
> \ObjectFactory.cs:line 117
>    at MyCompany.Toolkit.Testing.Utilities.DataTestCase..ctor() in C:
> \Development\dev\Toolkit\Toolkit.Testing\Utilities\TestCase.cs:line 92
>    at MyCompany.Data.Testing.OffersTest..ctor() in C:\Development\dev
> \Data\Data.Testing\OffersTest.cs:line 30
> --TargetInvocationException
>    at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
> Object[] arguments, SignatureStruct& sig, MethodAttributes
> methodAttributes, RuntimeTypeHandle typeOwner)
>    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object
> [] arguments, Signature sig, MethodAttributes methodAttributes,
> RuntimeTypeHandle typeOwner)
>    at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj,
> BindingFlags invokeAttr, Binder binder, Object[] parameters,
> CultureInfo culture)
>    at System.Reflection.MethodBase.Invoke(Object obj, Object[]
> parameters)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateI 
> nstance
> (Type implType, Object[] arguments, Type[] signature)
>    at
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInsta 
> nce
> (CreationContext context, Object[] arguments, Type[] signature)
> --NotSupportedException
>    at
> FluentNHibernate.MappingModel.BiDirectionalManyToManyPairingVisitor.Process 
> Collection
> (ICollectionMapping mapping)
>    at
> FluentNHibernate.MappingModel.DefaultMappingModelVisitor.ProcessBag
> (BagMapping bagMapping)
>    at
> FluentNHibernate.MappingModel.Collections.BagMapping.AcceptVisitor
> (IMappingModelVisitor visitor)
>    at FluentNHibernate.MappingModel.DefaultMappingModelVisitor.Visit
> (ICollectionMapping collectionMapping)
>    at FluentNHibernate.MappingModel.MappedMembers.AcceptVisitor
> (IMappingModelVisitor visitor)
>    at
> FluentNHibernate.MappingModel.ClassBased.ClassMappingBase.AcceptVisitor
> (IMappingModelVisitor visitor)
>    at
> FluentNHibernate.MappingModel.ClassBased.ClassMapping.AcceptVisitor
> (IMappingModelVisitor visitor)
>    at FluentNHibernate.MappingModel.DefaultMappingModelVisitor.Visit
> (ClassMapping classMapping)
>    at FluentNHibernate.MappingModel.HibernateMapping.AcceptVisitor
> (IMappingModelVisitor visitor)
>    at FluentNHibernate.PersistenceModel.ApplyVisitors(IEnumerable`1
> mappings)
>    at FluentNHibernate.PersistenceModel.BuildMappings()
>    at FluentNHibernate.PersistenceModel.EnsureMappingsBuilt()
>    at FluentNHibernate.PersistenceModel.Configure(Configuration cfg)
>    at FluentNHibernate.Automapping.AutoPersistenceModel.Configure
> (Configuration configuration)
>    at MyCompany.Data.NHFactory..ctor(String key, String configuration,
> String mappings, Boolean isProfiled, Boolean isexported) in C:
> \Development\dev\Data\Data.NHibernate\NHFactory.cs:line 154
>    at MyCompany.Data.NHFactory..ctor(String key, String configuration,
> Boolean isProfiled) in C:\Development\dev\Data\Data.NHibernate
> \NHFactory.cs:line 39
> DEBUG [NHFactory:oracle] - Profiler initialized
> DEBUG [NHFactory:oracle] - Configuration initialized
>
> 0 passed, 1 failed, 0 skipped, took 3.34 seconds (NUnit 2.5.2).
>
> On Dec 16, 3:19 pm, Diego Mijelshon <[email protected]> wrote:
>
>
>
> > Can you send the full exception stack trace?
>
> >    Diego
>
> > On Wed, Dec 16, 2009 at 17:15, Rob Gibbens <[email protected]> wrote:
> > > Based on your advice, I also remove the .Inverse from the child's
> > > mapping to the parent, but I still get the same problem.
>
> > > On Dec 16, 3:09 pm, Rob Gibbens <[email protected]> wrote:
> > > > Thanks for the quick reply.
>
> > > > The child entity and mapping look like this (just the opposite of the
> > > > parent)...
>
> > > ---------------------------------------------------------------------------
> > > ---------------------------
> > > > public partial class ChildEntity : AuditableDataEntity<ChildEntity>
> > > > {
> > > >   public virtual IList<ParentEntity> Parents { get; set; }
> > > >   public virtual IList<ParentEntity> IncludedParents { get; set; }
>
> > > > }
>
> > > > public partial class ChildMap : IAutoMappingOverride<ChildEntity>
> > > > {
> > > >         public void Override(AutoMapping<ChildEntity> mapping)
> > > >         {
> > > >                 mapping.Table("tbl_Child");
>
> > > >                 mapping.HasManyToMany(x => x.Parents)
> > > >                 .Table("tbl_Parent_Child_Xref")
> > > >                 .ParentKeyColumn("col_Child_ID")
> > > >                 .ChildKeyColumn("col_Parent_ID")
> > > >                 .Inverse()
> > > >                 .Cascade.All();
>
> > > >             mapping.HasManyToMany(x => x.IncludedParents)
> > > >                 .Table("tbl_Include_ParentChild_Xref")
> > > >                 .ParentKeyColumn("col_Child_ID")
> > > >                 .ChildKeyColumn("col_Parent_ID")
> > > >                 .Inverse()
> > > >                 .Cascade.All();
> > > >         }
>
> > > > }
>
> > > ---------------------------------------------------------------------------
> > > -------------
>
> > > > On Dec 16, 12:59 pm, Diego Mijelshon <[email protected]> wrote:
>
> > > > > Well, NHibernate supports it without a problem, so it must be a 
> > > > > problem
> > > with
> > > > > that fluent mapping.
> > > > > What's the code for ChildEntity? I see you have Inverse() on the
> > > mapping, so
> > > > > there must be a related, non-inverse mapping on the other side...
>
> > > > > Here's my hbm mapping for that:
>
> > > > >  <class name="ParentEntity" table="tbl_Parent"> <id ...> <bag
> > > name="Children"
> > > > > table="tbl_Parent_Child_Xref"> <key column="col_Parent_ID"/>
> > > <many-to-many
> > > > > class="ChildEntity" column="col_Child_ID"/> </bag> <bag name="Included
> > > > > Children" table="tbl_Include_ParentChild_Xref"> <key
> > > > > column="col_Parent_ID"/> <many-to-many class="ChildEntity"
> > > > > column="col_Child_ID"/> </bag> </class>
>
> > > > >    Diego
>
> > > > > On Wed, Dec 16, 2009 at 13:37, Rob Gibbens <[email protected]>
> > > wrote:
> > > > > > Does anybody know how I would map an entity with two many-to-many
> > > > > > collections of the same child type.
>
> > > > > > My database structure is this....
> > > > > > -----------------------------------------------------------------
> > > > > > The "normal" relationship will be....
>
> > > > > > tbl_Parent
> > > > > >  col_Parent_ID
>
> > > > > > tbl_Parent_Child_Xref
> > > > > >   col_Parent_ID
> > > > > >   col_Child_ID
>
> > > > > > tbl_Child
> > > > > >   col_Child_ID
>
> > > > > > -----------------------------------------------------------------
> > > > > > The alternative relationship is...
>
> > > > > > tbl_Parent
> > > > > >  col_Parent_ID
>
> > > > > > tbl_Include_ParentChild_Xref
> > > > > >   col_Parent_ID
> > > > > >   col_Child_ID
>
> > > > > > tbl_Child
> > > > > >   col_Child_ID...
>
> read more »

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to