everything is possible in a release if we don't have a test for your specific usecase. no-test= everything possible
On Fri, Dec 17, 2010 at 11:59 AM, Richard Birkby <[email protected]> wrote: > I've upgrade a project of mine from NH2 to NH3 and now get an error. So I > created a testcase reduction - but I can't believe this is a bug - at least > not one that would have got into a release. I'd like to know if I'm being > stupid before I create a new JIRA report. What is wrong with this code? The > error produced is: > > 14:51:43,918 DEBUG SQL:0 - > SELECT > e1x1_.id as y0_ > FROM > Entity2 this_ > 14:51:44,480 WARN ADOExceptionReporter:0 - > System.Data.SqlClient.SqlException: The multi-part identifier "e1x1_.id" > could not be bound. > > > [Test] > public void ShouldContainJoin() > { > using (var session = OpenSession()) > { > using (var ls = new SqlLogSpy()) > { > ICriteria criteria = > session.CreateCriteria(typeof(Entity2), "e2") > .CreateAlias("e2.Entity1", "e1") > .SetProjection(Projections.Property("e1.Id")); > > criteria.List<Guid>(); > } > } > } > > ------- > > public class Entity1 > { > public virtual Guid Id { get; set; } > } > > public class Entity2 > { > public virtual Entity1 Entity1 { get; set; } > public virtual Entity3 Entity3 { get; set; } > > public virtual bool Equals(Entity2 other) > { > if (ReferenceEquals(null, other)) > { > return false; > } > if (ReferenceEquals(this, other)) > { > return true; > } > return Equals(other.Entity1, Entity1) && Equals(other.Entity3, > Entity3); > } > > public override bool Equals(object obj) > { > return Equals(obj as Entity2); > } > > public override int GetHashCode() > { > unchecked > { > return ((Entity1 != null ? Entity1.GetHashCode() : 0) * > 397) ^ (Entity3 != null ? Entity3.GetHashCode() : 0); > } > } > } > > public class Entity3 > { > public virtual Guid Id { get; set; } > } > > ----- > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="NHibernate.Test" > namespace="NHibernate.Test.NHSpecificTest.NHXXXX"> > <class name="Entity1" table="Entity1"> > <id name="Id" type="Guid" column="id"> > <generator class="guid" /> > </id> > </class> > <class name="Entity2" table="Entity2"> > <composite-id> > <key-many-to-one name="Entity1" class="Entity1" column="id1" /> > <key-many-to-one name="Entity3" class="Entity3" column="id3" /> > </composite-id> > </class> > <class name="Entity3" table="Entity3"> > <id name="Id" type="Guid" column="id"> > <generator class="guid" /> > </id> > </class> > </hibernate-mapping> > -- Fabio Maulo
