.net - I am getting a "duplicate association path" error in the NHibernate Criteria when accessing the same table twice -


i have createcriteria adds join same table twice different aliases:

acriteria.createcriteria("color", "co").add(expression.in("co.colorid", bikush.color.select(x => x.colorid).tolist()));  acriteria.createcriteria("color","fco").add(expression.in("fco.colorid",bikush.fccolor.select(x => x.colorid).tolist())); 

i'm getting error "duplicate association path"

here sql want generate:

select b.bikushid, c.[name] plaincolor, fc.[name] fancycolor bikush b inner join bikushincolor clt on clt.bikushid = b.bikushid inner join color c on clt.colorid = c.colorid inner join bikushinfccolor bifc on b.bikushid = bifc.bikushid inner join color fc on bifc.colorid =fc.colorid

is there anyway around using criteriaapi of nhibernate?

thanks

if understand correctly, should merge thies 2 calls in one:

    criteria.createcriteria("color", "co")             .add(expression.in("co.colorid", bikush.color.select(x => x.colorid).tolist()));             .add(expression.in("co.colorid", bikush.fccolor.select(x => x.colorid).tolist())); 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -