We're updating the issue view to help you get more done. 

Duplicate Association Path when creating multiple aliases

Description

Hello All,
This is a bug I have noticed on my current NHibernate project. I tried to search for it on this forum and don't know if it has been rectified as of yet or not. However, the explanation for this bug is provided here:
http://derek-says.blogspot.com/2008/06/duplicate-association-path-bug-in.html

I would like to know if there is a way using criteria API to create multiple aliases that point to the same table. I would highly appreciate it if you could share any information on the same.
My criteria is pretty simple:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 LeadManager manager = new LeadManager(); ISession mySession = manager.Session.GetISession(); ICriteria criteria = mySession.CreateCriteria(typeof(Lead)); criteria.SetProjection(Projections.Distinct(Projections.Property("Id"))); criteria.Add(Expression.Eq("CustomerId", 950)); criteria.CreateAlias("CandidateMember", "candidate"); criteria.CreateAlias("candidate.ExtensionValues", "extensions"); criteria.CreateAlias("extensions.ExtensionValueTypeMember", "extensionTypes"); Conjunction c = new Conjunction(); c.Add(Expression.Eq("extensionTypes.Id", 1)); c.Add(Expression.In("extensions.ExtensionDatum", new object[] { 'A', 'B' })); criteria.Add(c); criteria.CreateAlias("candidate.ExtensionValues", "extensions1"); criteria.CreateAlias("extensions1.ExtensionValueTypeMember", "extensionTypes1"); Conjunction c1 = new Conjunction(); c1.Add(Expression.Eq("extensionTypes.Id", 2)); c1.Add(Expression.In("extensions.ExtensionDatum", new object[] { 'A', 'B', 'C', 'D' })); criteria.Add(c1); criteria.SetMaxResults(10); long[] leadIds = criteria.List<Int64>().ToArray();

Environment

None

Status

Assignee

Unassigned

Reporter

Anup Marwadi

Components

Fix versions

Affects versions

2.1.1.GA

Priority

Trivial