|
From: <fab...@us...> - 2009-07-04 18:58:09
|
Revision: 4573
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4573&view=rev
Author: fabiomaulo
Date: 2009-07-04 18:58:06 +0000 (Sat, 04 Jul 2009)
Log Message:
-----------
Merge r4572 (fix NH-1857)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/JoinProcessor.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Department.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Employee.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/JoinProcessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/JoinProcessor.cs 2009-07-04 18:53:07 UTC (rev 4572)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/JoinProcessor.cs 2009-07-04 18:58:06 UTC (rev 4573)
@@ -54,6 +54,8 @@
return JoinType.InnerJoin;
case HqlSqlWalker.RIGHT_OUTER:
return JoinType.RightOuterJoin;
+ case HqlSqlWalker.FULL:
+ return JoinType.FullJoin;
default:
throw new AssertionFailure("undefined join type " + astJoinType);
}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Department.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Department.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Department.cs 2009-07-04 18:58:06 UTC (rev 4573)
@@ -0,0 +1,37 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Iesi.Collections.Generic;
+
+namespace NHibernate.Test.NHSpecificTest.NH1857
+{
+ public class Department
+ {
+ private Department() {}
+
+ public Department(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+
+ public int Id { get; private set; }
+
+ public string Name { get; set; }
+
+ private ISet<Employee> _employees = new HashedSet<Employee>();
+
+ public ReadOnlyCollection<Employee> Employees
+ {
+ get { return new List<Employee>(_employees).AsReadOnly(); }
+ }
+
+ public void AddEmployee(Employee e)
+ {
+ if (e != null && !_employees.Contains(e))
+ {
+ e.Department = this;
+ _employees.Add(e);
+ }
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Employee.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Employee.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Employee.cs 2009-07-04 18:58:06 UTC (rev 4573)
@@ -0,0 +1,24 @@
+using System;
+
+namespace NHibernate.Test.NHSpecificTest.NH1857
+{
+ public class Employee
+ {
+ private Employee() {}
+
+ public Employee(int id, string name, DateTime d)
+ {
+ Id = id;
+ Name = name;
+ CompanyJoinDate = d;
+ }
+
+ public int Id { get; private set; }
+
+ public string Name { get; set; }
+
+ public DateTime CompanyJoinDate { get; set; }
+
+ public Department Department { get; internal set; }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs 2009-07-04 18:58:06 UTC (rev 4573)
@@ -0,0 +1,58 @@
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH1857
+{
+ [TestFixture]
+ public class FullJoinTest : BugTestCase
+ {
+ protected override void OnSetUp()
+ {
+ base.OnSetUp();
+ using (ISession session = OpenSession())
+ {
+ var e1 = new Employee(1, "Employee1", new DateTime(1995, 1, 1));
+ var e2 = new Employee(2, "Employee2", new DateTime(2007, 8, 1));
+ var e3 = new Employee(3, "Employee3", new DateTime(2009, 5, 1));
+
+ var d1 = new Department(1, "Department S");
+
+ d1.AddEmployee(e1);
+ d1.AddEmployee(e2);
+
+ session.SaveOrUpdate(d1);
+ session.SaveOrUpdate(e1);
+ session.SaveOrUpdate(e2);
+ session.SaveOrUpdate(e3);
+
+ session.Flush();
+ }
+ }
+
+ protected override void OnTearDown()
+ {
+ base.OnTearDown();
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.CreateQuery("delete from Employee").ExecuteUpdate();
+ session.CreateQuery("delete from Department").ExecuteUpdate();
+ t.Commit();
+ }
+ }
+
+ [Test]
+ public void TestFullJoin()
+ {
+ using (ISession s = OpenSession())
+ {
+ IQuery q = s.CreateQuery("from Employee as e full join e.Department");
+
+ IList result = q.List();
+
+ Assert.AreEqual(3, result.Count);
+ }
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/Mappings.hbm.xml 2009-07-04 18:58:06 UTC (rev 4573)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH1857"
+ default-lazy="false">
+ <class name="Department">
+ <id name="Id">
+ <generator class="assigned" />
+ </id>
+
+ <property name="Name" />
+
+ <set name="Employees" access="field.camelcase-underscore" inverse="true"
+ cascade="all-delete-orphan" lazy="false">
+ <key column="DepartmentId" />
+ <one-to-many class="Employee"/>
+ </set>
+ </class>
+
+ <class name="Employee">
+ <id name="Id">
+ <generator class="assigned" />
+ </id>
+
+ <property name="Name" />
+
+ <property name="CompanyJoinDate" />
+
+ <many-to-one name="Department" class="Department" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-07-04 18:53:07 UTC (rev 4572)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-07-04 18:58:06 UTC (rev 4573)
@@ -532,6 +532,9 @@
<Compile Include="NHSpecificTest\NH1849\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1850\Customer.cs" />
<Compile Include="NHSpecificTest\NH1850\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH1857\Department.cs" />
+ <Compile Include="NHSpecificTest\NH1857\Employee.cs" />
+ <Compile Include="NHSpecificTest\NH1857\FullJoinTest.cs" />
<Compile Include="NHSpecificTest\NH1859\DomainClass.cs" />
<Compile Include="NHSpecificTest\NH1859\SampleTest.cs" />
<Compile Include="NHSpecificTest\NH1864\Fixture.cs" />
@@ -1947,6 +1950,7 @@
<EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" />
<EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH1857\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1859\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1864\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1849\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|