I was constructing a ICriteria with aliases and kept getting a duplicate join in my FROM clause of the output sql with the error 'table names must be unique'. Here's the fixins on the criteria:
crit.CreateAlias("max.Sample", "s")
.CreateAlias("s.Project", "proj")
.CreateAlias("s.Project.EnterpriseProject", "entProj")
.CreateAlias("s.MaterialCode", "mc");
The problem was the 'mc' alias that kept producing 3 different joins that were equal. Finally I looked into my mapping and since I am mapping to an interface I had <subclass>ed implementations of the interface. Now since I am using access strategy 'nosetter' I was forced to repeat the mapping for the MaterialCode property in each concrete mapping. There are 3 implementations. Thus, when Hibernate created the sql it was creating the join to the materialCode (mc) three times.
To fix it I am forced to include a setter on the MaterialCode property and declare it in the interface.
Problem solved.