From: <ric...@us...> - 2009-08-25 12:44:38
|
Revision: 4699 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4699&view=rev Author: ricbrown Date: 2009-08-25 12:44:30 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Fix NH-1939 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs branches/2.1.x/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs branches/2.1.x/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml Modified: branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2009-08-19 19:43:56 UTC (rev 4698) +++ branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2009-08-25 12:44:30 UTC (rev 4699) @@ -2,7 +2,7 @@ /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -83,7 +83,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -110,7 +110,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -128,7 +128,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -193,7 +193,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -207,7 +207,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -372,7 +372,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -386,7 +386,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -413,7 +413,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheUsage { @@ -436,7 +436,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheInclude { @@ -451,7 +451,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -465,7 +465,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -524,7 +524,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOndelete { @@ -539,7 +539,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -565,7 +565,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -586,7 +586,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -618,7 +618,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -632,7 +632,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -770,7 +770,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -784,7 +784,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOuterJoinStrategy { @@ -803,7 +803,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmFetchMode { @@ -818,7 +818,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmLaziness { @@ -837,7 +837,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmNotFoundMode { @@ -852,7 +852,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -888,7 +888,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1005,7 +1005,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1023,7 +1023,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1041,7 +1041,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPropertyGeneration { @@ -1060,7 +1060,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1121,7 +1121,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1151,7 +1151,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1255,7 +1255,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1277,7 +1277,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmRestrictedLaziness { @@ -1292,7 +1292,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1329,7 +1329,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1343,7 +1343,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1373,7 +1373,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCustomSQLCheck { @@ -1392,7 +1392,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCollectionFetchMode { @@ -1411,7 +1411,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1591,7 +1591,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCollectionLazy { @@ -1610,7 +1610,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1829,7 +1829,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1851,7 +1851,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTuplizerEntitymode { @@ -1870,7 +1870,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1920,7 +1920,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1970,7 +1970,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2015,7 +2015,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmUnsavedValueType { @@ -2034,7 +2034,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2086,7 +2086,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2104,7 +2104,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2158,7 +2158,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2185,7 +2185,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2271,7 +2271,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2335,7 +2335,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2520,7 +2520,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2714,7 +2714,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2733,7 +2733,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2752,7 +2752,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2778,7 +2778,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2808,7 +2808,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2843,7 +2843,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2878,7 +2878,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2971,7 +2971,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3113,7 +3113,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPrimitivearrayOuterjoin { @@ -3132,7 +3132,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPrimitivearrayFetch { @@ -3151,7 +3151,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3335,7 +3335,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3518,7 +3518,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3551,7 +3551,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3604,7 +3604,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTimestampUnsavedvalue { @@ -3619,7 +3619,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTimestampSource { @@ -3634,7 +3634,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmVersionGeneration { @@ -3649,7 +3649,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3710,7 +3710,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3762,7 +3762,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3845,7 +3845,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmJoinFetch { @@ -3860,7 +3860,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4021,7 +4021,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4042,7 +4042,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4073,7 +4073,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4095,7 +4095,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4109,7 +4109,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmLockMode { @@ -4136,7 +4136,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4175,7 +4175,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4189,7 +4189,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4220,7 +4220,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4238,7 +4238,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4313,7 +4313,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4331,7 +4331,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmFlushMode { @@ -4350,7 +4350,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheMode { @@ -4377,7 +4377,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4467,7 +4467,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4606,7 +4606,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4764,7 +4764,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPolymorphismType { @@ -4779,7 +4779,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOptimisticLockMode { @@ -4802,7 +4802,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4816,7 +4816,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4836,7 +4836,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4845,12 +4845,16 @@ public partial class HbmDefinition { /// <remarks/> + [System.Xml.Serialization.XmlElementAttribute("param")] + public HbmParam[] param; + + /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string @class; } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4864,7 +4868,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4882,7 +4886,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4908,7 +4912,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4926,7 +4930,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -5015,7 +5019,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -5037,7 +5041,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.2001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.4000")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] Added: branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/HbmDefinition.cs 2009-08-25 12:44:30 UTC (rev 4699) @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace NHibernate.Cfg.MappingSchema +{ + partial class HbmDefinition : HbmBase + { + public IDictionary<string, string> FindParameterValues() + { + IDictionary<string, string> parameters = new Dictionary<string, string>(); + + if (param != null) + { + foreach (HbmParam parameter in param) + { + parameters.Add(parameter.name, parameter.GetText()); + } + } + + return parameters; + } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs 2009-08-19 19:43:56 UTC (rev 4698) +++ branches/2.1.x/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/AuxiliaryDatabaseObjectFactory.cs 2009-08-25 12:44:30 UTC (rev 4699) @@ -49,6 +49,8 @@ customObject.AddDialectScope(dialectName); } + customObject.SetParameterValues(definitionSchema.FindParameterValues()); + return customObject; } catch (TypeLoadException exception) Modified: branches/2.1.x/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs 2009-08-19 19:43:56 UTC (rev 4698) +++ branches/2.1.x/nhibernate/src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs 2009-08-25 12:44:30 UTC (rev 4699) @@ -17,6 +17,7 @@ public abstract class AbstractAuxiliaryDatabaseObject : IAuxiliaryDatabaseObject { private readonly HashedSet<string> dialectScopes; + private IDictionary<string, string> parameters = new Dictionary<string, string>(); protected AbstractAuxiliaryDatabaseObject() { @@ -38,6 +39,11 @@ get { return dialectScopes; } } + public IDictionary<string, string> Parameters + { + get { return parameters; } + } + public bool AppliesToDialect(Dialect.Dialect dialect) { // empty means no scoping @@ -47,6 +53,10 @@ public abstract string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema); public abstract string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema); - public void SetParameterValues(IDictionary<string, string> parameters) {} + public void SetParameterValues(IDictionary<string, string> parameters) + { + this.parameters = parameters; + } + } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-08-19 19:43:56 UTC (rev 4698) +++ branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-08-25 12:44:30 UTC (rev 4699) @@ -458,6 +458,7 @@ <Compile Include="Cache\FakeCache.cs" /> <Compile Include="Cfg\FilterSecondPassArgs.cs" /> <Compile Include="Cfg\MappingSchema\AbstractDecoratable.cs" /> + <Compile Include="Cfg\MappingSchema\HbmDefinition.cs" /> <Compile Include="Cfg\MappingSchema\HbmTimestamp.cs" /> <Compile Include="Cfg\MappingSchema\HbmVersion.cs" /> <Compile Include="Cfg\MappingSchema\IDecoratable.cs" /> Modified: branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-08-19 19:43:56 UTC (rev 4698) +++ branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-08-25 12:44:30 UTC (rev 4699) @@ -367,6 +367,9 @@ </xs:element> <xs:element name="definition"> <xs:complexType> + <xs:sequence> + <xs:element ref="param" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> <xs:attribute name="class" use="required" type="xs:string" /> </xs:complexType> </xs:element> Property changes on: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939 ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/AuxType.cs 2009-08-25 12:44:30 UTC (rev 4699) @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using NHibernate; +using NHibernate.Engine; +using NHibernate.Mapping; + +namespace NHibernate.Test.NHSpecificTest.NH1939 +{ + public class AuxType : AbstractAuxiliaryDatabaseObject + { + + override public string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema) + { + return "select '" + Parameters["scriptParameter"] + "'"; + } + + override public string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema) + { + return "select 'drop script'"; + } + + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Fixture.cs 2009-08-25 12:44:30 UTC (rev 4699) @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using NHibernate.Tool.hbm2ddl; +using System.Text; +using NHibernate.Cfg; + +namespace NHibernate.Test.NHSpecificTest.NH1939 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + private Configuration cfg; + private StringBuilder schemaBuilder; + + private void AddString(string sqlString) + { + schemaBuilder.Append(sqlString); + } + + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + return (dialect is Dialect.MsSql2000Dialect); + } + + protected override void Configure(Configuration configuration) + { + base.Configure(configuration); + cfg = configuration; + } + + [Test] + public void Can_Parameterise_Auxiliary_Database_Objects() + { + schemaBuilder = new StringBuilder(); + + SchemaExport schemaExport = new SchemaExport(cfg); + schemaExport.Execute(AddString, false, false); + + string schema = schemaBuilder.ToString(); + + Assert.That(schema.Contains("select 'drop script'"), Is.True, + "schema drop script not exported"); + + Assert.That(schema.Contains("select 'create script'"), Is.True, + "parameterised schema create script not exported"); + } + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1939/Mappings.hbm.xml 2009-08-25 12:44:30 UTC (rev 4699) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1939"> + + <database-object> + <definition class="AuxType"> + <param name="scriptParameter">create script</param> + </definition> + </database-object> + +</hibernate-mapping> Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-19 19:43:56 UTC (rev 4698) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-25 12:44:30 UTC (rev 4699) @@ -562,6 +562,8 @@ <Compile Include="NHSpecificTest\NH1908\Model.cs" /> <Compile Include="NHSpecificTest\NH1914\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1914\Model.cs" /> + <Compile Include="NHSpecificTest\NH1939\AuxType.cs" /> + <Compile Include="NHSpecificTest\NH1939\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> <Compile Include="NHSpecificTest\NH473\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Parent.cs" /> @@ -1972,6 +1974,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1927\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-08-28 11:52:13
|
Revision: 4701 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4701&view=rev Author: ricbrown Date: 2009-08-28 11:52:04 +0000 (Fri, 28 Aug 2009) Log Message: ----------- Fix NH-1905 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-08-25 12:45:10 UTC (rev 4700) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs 2009-08-28 11:52:04 UTC (rev 4701) @@ -496,7 +496,13 @@ // /////////////////////////////////////////////////////////////////////////////// - if ( elem == null ) + bool found = elem != null; + // even though we might find a pre-existing element by join path, for FromElements originating in a from-clause + // we should only ever use the found element if the aliases match (null != null here). Implied joins are + // always (?) ok to reuse. + bool useFoundFromElement = found && ( elem.IsImplied || ( AreSame(classAlias, elem.ClassAlias ) ) ); + + if ( ! useFoundFromElement ) { // If this is an implied join in a from element, then use the impled join type which is part of the // tree parser's state (set by the gramamar actions). @@ -531,6 +537,11 @@ FromElement = elem; // This 'dot' expression now refers to the resulting from element. } + private bool AreSame(String alias1, String alias2) { + // again, null != null here + return !StringHelper.IsEmpty( alias1 ) && !StringHelper.IsEmpty( alias2 ) && alias1.Equals( alias2 ); + } + private void SetImpliedJoin(FromElement elem) { _impliedJoin = elem; Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Fixture.cs 2009-08-28 11:52:04 UTC (rev 4701) @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NHibernate.Cfg; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1905 +{ + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void Query() + { + using (ISession s = OpenSession()) + { + s.CreateQuery("select d from Det d left join d.Mas m where (SELECT count(e) FROM d.Mas.Els e WHERE e.Descr='e1')>0") + .List(); + } + } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Mappings.hbm.xml 2009-08-28 11:52:04 UTC (rev 4701) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1905"> + + + <class name="Mas" table="mas" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <set name="Els" table="MasEls" > + <key column="IdMas" /> + <many-to-many column="IdEls" class="El"/> + </set> + </class> + + <class name="Det" table="det" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <many-to-one class="Mas" name="Mas" column="IdMas" /> + </class> + + <class name="El" table="Els" > + <id name="Id" type="Int32" > + <generator class="assigned" /> + </id> + <property name="Descr" type="String" /> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1905/Model.cs 2009-08-28 11:52:04 UTC (rev 4701) @@ -0,0 +1,60 @@ +using Iesi.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1905 +{ + public class Mas + { + private int _Id; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + private ISet<El> _Els; + + public virtual ISet<El> Els + { + get { return _Els; } + set { _Els = value; } + } + } + + + public class Det + { + private int _Id; + private Mas _Mas; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + public virtual Mas Mas + { + get { return _Mas; } + set { _Mas = value; } + } + } + + public class El + { + private int _Id; + private string _Descr; + + public virtual int Id + { + get { return _Id; } + set { _Id = value; } + } + + public virtual string Descr + { + get { return _Descr; } + set { _Descr = value; } + } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-25 12:45:10 UTC (rev 4700) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-28 11:52:04 UTC (rev 4701) @@ -359,6 +359,8 @@ <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagPartialNameFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\Something.cs" /> + <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1905\Model.cs" /> <Compile Include="NHSpecificTest\NH1911\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1911\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> @@ -1974,6 +1976,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-08 11:13:59
|
Revision: 4707 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4707&view=rev Author: ricbrown Date: 2009-09-08 11:13:42 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Fix NH-1938 (QBE case insensitive) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs 2009-09-03 17:15:55 UTC (rev 4706) +++ branches/2.1.x/nhibernate/src/NHibernate/Criterion/LikeExpression.cs 2009-09-08 11:13:42 UTC (rev 4707) @@ -74,7 +74,19 @@ lhs.Add(columns[0]); criteriaQuery.AddUsedTypedValues(GetTypedValues(criteria, criteriaQuery)); - lhs.Add(" like ").AddParameter(); + + if (ignoreCase) + { + Dialect.Dialect dialect = criteriaQuery.Factory.Dialect; + lhs.Add(" like ") + .Add(dialect.LowercaseFunction) + .Add(StringHelper.OpenParen) + .AddParameter() + .Add(StringHelper.ClosedParen); + } + else + lhs.Add(" like ").AddParameter(); + if (escapeChar.HasValue) lhs.Add(" escape '" + escapeChar + "'"); return lhs.ToSqlString(); Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Fixture.cs 2009-09-08 11:13:42 UTC (rev 4707) @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using NHibernate.Criterion; + +namespace NHibernate.Test.NHSpecificTest.NH1938 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + // Database needs to be case-sensitive + return (dialect is NHibernate.Dialect.Oracle10gDialect); + } + + [Test] + public void Can_Query_By_Example_Case_Insensitive() + { + using (ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + s.Save(new Person() { Name = "John Smith" }); + + Person examplePerson = new Person() { Name = "oHn" }; + IList<Person> matchingPeople; + + matchingPeople = + s.CreateCriteria<Person>() + .Add(Example + .Create(examplePerson) + .EnableLike(MatchMode.Anywhere) + .IgnoreCase()) + .List<Person>(); + + Assert.That(matchingPeople.Count, Is.EqualTo(1)); + + matchingPeople = + s.CreateCriteria<Person>() + .Add(Example + .Create(examplePerson) + .EnableLike(MatchMode.Anywhere)) + .List<Person>(); + + Assert.That(matchingPeople.Count, Is.EqualTo(0)); + + t.Rollback(); + } + } + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Mappings.hbm.xml 2009-09-08 11:13:42 UTC (rev 4707) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1938"> + + <class name="Person"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="Name"/> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1938/Model.cs 2009-09-08 11:13:42 UTC (rev 4707) @@ -0,0 +1,19 @@ +using System; +using System.Xml.Serialization; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +using NHibernate; +using NHibernate.Classic; + +namespace NHibernate.Test.NHSpecificTest.NH1938 +{ + + public class Person + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + } + +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-03 17:15:55 UTC (rev 4706) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 11:13:42 UTC (rev 4707) @@ -564,6 +564,8 @@ <Compile Include="NHSpecificTest\NH1908\Model.cs" /> <Compile Include="NHSpecificTest\NH1914\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1914\Model.cs" /> + <Compile Include="NHSpecificTest\NH1938\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1938\Model.cs" /> <Compile Include="NHSpecificTest\NH1939\AuxType.cs" /> <Compile Include="NHSpecificTest\NH1939\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> @@ -1976,6 +1978,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-08 13:13:58
|
Revision: 4709 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4709&view=rev Author: ricbrown Date: 2009-09-08 13:13:49 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Fix NH-1926 (SchemaUpdate on dialect with sequences) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs 2009-09-08 11:14:30 UTC (rev 4708) +++ branches/2.1.x/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs 2009-09-08 13:13:49 UTC (rev 4709) @@ -117,7 +117,7 @@ using (IDataReader rs = statement.ExecuteReader()) { while (rs.Read()) - sequences.Add(((string) rs[1]).ToLower().Trim()); + sequences.Add(((string) rs[0]).ToLower().Trim()); } } } Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 11:14:30 UTC (rev 4708) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-08 13:13:49 UTC (rev 4709) @@ -1233,6 +1233,7 @@ <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\HeavyEntity.cs" /> <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\SchemaMetadataUpdaterFixture.cs" /> <Compile Include="Tools\hbm2ddl\SchemaUpdate\MigrationFixture.cs" /> + <Compile Include="Tools\hbm2ddl\SchemaUpdate\Person.cs" /> <Compile Include="Tools\hbm2ddl\SchemaUpdate\Version.cs" /> <Compile Include="SecondLevelCacheTest\AnotherItem.cs" /> <Compile Include="SecondLevelCacheTest\Item.cs" /> @@ -1978,6 +1979,8 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> + <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1905\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1939\Mappings.hbm.xml" /> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/1_Person.hbm.xml 2009-09-08 13:13:49 UTC (rev 4709) @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.Tools.hbm2ddl.SchemaUpdate" + assembly="NHibernate.Test"> + + <class name="Person"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="Name"/> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/2_Person.hbm.xml 2009-09-08 13:13:49 UTC (rev 4709) @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.Tools.hbm2ddl.SchemaUpdate" + assembly="NHibernate.Test"> + + <class name="Person"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="FirstName"/> + <property name="LastName"/> + </class> + +</hibernate-mapping> Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs 2009-09-08 11:14:30 UTC (rev 4708) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/MigrationFixture.cs 2009-09-08 13:13:49 UTC (rev 4709) @@ -10,12 +10,9 @@ [TestFixture] public class MigrationFixture { - [Test] - public void SimpleColumnAddition() + + private void MigrateSchema(string resource1, string resource2) { - String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Version.hbm.xml"; - String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Version.hbm.xml"; - Configuration v1cfg = TestConfigurationHelper.GetDefaultConfiguration(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource1)) v1cfg.AddInputStream(stream); @@ -24,16 +21,40 @@ Tool.hbm2ddl.SchemaUpdate v1schemaUpdate = new Tool.hbm2ddl.SchemaUpdate(v1cfg); v1schemaUpdate.Execute(true, true); + foreach (Exception e in v1schemaUpdate.Exceptions) + Console.WriteLine(e); + Assert.AreEqual(0, v1schemaUpdate.Exceptions.Count); Configuration v2cfg = TestConfigurationHelper.GetDefaultConfiguration(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource2)) v2cfg.AddInputStream(stream); - Tool.hbm2ddl.SchemaUpdate v2schemaUpdate = new Tool.hbm2ddl.SchemaUpdate(v2cfg); v2schemaUpdate.Execute(true, true); + + foreach (Exception e in v2schemaUpdate.Exceptions) + Console.WriteLine(e); + Assert.AreEqual(0, v2schemaUpdate.Exceptions.Count); } + + [Test] + public void SimpleColumnAddition() + { + String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Version.hbm.xml"; + String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Version.hbm.xml"; + + MigrateSchema(resource1, resource2); + } + + [Test] + public void SimpleColumnReplace() + { + String resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.2_Person.hbm.xml"; + String resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaUpdate.1_Person.hbm.xml"; + + MigrateSchema(resource1, resource2); + } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaUpdate/Person.cs 2009-09-08 13:13:49 UTC (rev 4709) @@ -0,0 +1,10 @@ +namespace NHibernate.Test.Tools.hbm2ddl.SchemaUpdate +{ + public class Person + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + public virtual string FirstName { get; set; } + public virtual string LastName { get; set; } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-15 21:40:02
|
Revision: 4713 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4713&view=rev Author: ricbrown Date: 2009-09-15 21:39:54 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Simplify filter parameter reordering and possible fix for NH-1908 threading issue. Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/QueryParameters.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -39,6 +39,7 @@ private object _optionalId; private string _comment; private bool _readOnly; + private IDictionary<int, int> _adjustedParameterLocations; private SqlString processedSQL; @@ -286,15 +287,12 @@ /************** Filters ********************************/ - private void AdjustPostionalParameterLocations(int parameterIndex) + public int FindAdjustedParameterLocation(int parameterIndex) { - for (int i = 0; i < _positionalParameterLocations.Length; i++) - { - if (_positionalParameterLocations[i] >= parameterIndex) - { - _positionalParameterLocations[i]++; - } - } + if (_adjustedParameterLocations == null) + return parameterIndex; + + return _adjustedParameterLocations[parameterIndex]; } public void ProcessFilters(SqlString sql, ISessionImplementor session) @@ -314,7 +312,9 @@ var result = new SqlStringBuilder(); - int parameterIndex = 0; // keep track of the positional parameter + int originalParameterIndex = 0; // keep track of the positional parameter + int newParameterIndex = 0; + _adjustedParameterLocations = new Dictionary<int, int>(); foreach (var part in sql.Parts) { @@ -329,7 +329,9 @@ // types for the named parameters are added later to the end of the list. // see test fixture NH-1098 - parameterIndex++; + _adjustedParameterLocations[originalParameterIndex] = newParameterIndex; + originalParameterIndex++; + newParameterIndex++; continue; } @@ -358,9 +360,8 @@ result.AddParameter(); filteredParameterTypes.Add(type); filteredParameterValues.Add(elementValue); - filteredParameterLocations.Add(parameterIndex); - AdjustPostionalParameterLocations(parameterIndex); - parameterIndex++; + filteredParameterLocations.Add(newParameterIndex); + newParameterIndex++; if (i < coll.Count) { result.Add(", "); @@ -376,9 +377,8 @@ result.AddParameter(); filteredParameterTypes.Add(type); filteredParameterValues.Add(value); - filteredParameterLocations.Add(parameterIndex); - AdjustPostionalParameterLocations(parameterIndex); - parameterIndex++; + filteredParameterLocations.Add(newParameterIndex); + newParameterIndex++; } } } @@ -401,7 +401,7 @@ for (int i = 0; i < _positionalParameterLocations.Length; i++) { - int location = _positionalParameterLocations[i]; + int location = FindAdjustedParameterLocation(_positionalParameterLocations[i]); object value = _positionalParameterValues[i]; IType type = _positionalParameterTypes[i]; ArrayHelper.SafeSetValue(values, location, value); @@ -428,7 +428,7 @@ int[] locations = getNamedParameterLocations(name); for (int i = 0; i < locations.Length; i++) { - int location = locations[i]; + int location = FindAdjustedParameterLocation(locations[i]); // can still clash with positional parameters // could consider throwing an exception to locate problem (NH-1098) Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -58,11 +58,6 @@ get { return HasSubselectLoadableCollections(); } } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - _queryTranslator.AdjustNamedParameterLocationsForQueryParameters(parameters); - } - protected override SqlString ApplyLocks(SqlString sql, IDictionary<string, LockMode> lockModes, Dialect.Dialect dialect) { Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -442,11 +442,6 @@ throw new QueryExecutionRequestException("Not supported for DML operations", _hql); } } - - public void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - ((ParameterTranslationsImpl) GetParameterTranslations()).AdjustNamedParameterLocationsForQueryParameters(parameters); - } } internal class HqlParseEngine Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -705,21 +705,6 @@ return o.ToArray(); } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameters.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } - public static string ScalarName(int x, int y) { return new StringBuilder() Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectCollectionLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -43,23 +43,5 @@ { return namedParameterLocMap[name]; } - - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - if (namedParameterLocMap == null) - return; - - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameterLocMap.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -45,24 +45,5 @@ { return namedParameterLocMap[name]; } - - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - if (namedParameterLocMap == null) - return; - - foreach (int existingParameterLocation in parameters.FilteredParameterLocations) - { - foreach (IList<int> namedParameterLocations in namedParameterLocMap.Values) - { - for (int index = 0; index < namedParameterLocations.Count; index++) - { - if (namedParameterLocations[index] >= existingParameterLocation) - namedParameterLocations[index]++; - } - } - } - } - } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -320,30 +320,6 @@ } } - protected override void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - var existingParameterLocations = parameters.FilteredParameterLocations.GetEnumerator(); - while (existingParameterLocations.MoveNext()) - { - foreach (string name in parameters.NamedParameters.Keys) - { - object locations = namedParameterBindPoints[name]; - if (locations is int) - { - namedParameterBindPoints[name] = ((int)locations) + 1; - } - else - { - IList locationsList = (IList)locations; - for (int i = 0; i < locationsList.Count; i++) - { - locationsList[i] = ((int)locationsList[i]) + 1; - } - } - } - } - } - protected override void AutoDiscoverTypes(IDataReader rs) { MetaData metadata = new MetaData(rs); Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -1174,7 +1174,6 @@ protected virtual SqlString ProcessFilters(QueryParameters parameters, ISessionImplementor session) { parameters.ProcessFilters(SqlString, session); - AdjustNamedParameterLocationsForQueryParameters(parameters); return parameters.FilteredSQL; } @@ -1269,15 +1268,6 @@ throw new AssertionFailure("no named parameters"); } - protected virtual void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - // if you support named parameter locations (by overriding GetNamedParameterLocs), then you might need to - // allow for the locations to be adjusted by introduced filtered parameters by overriding - // this method too. - if ((parameters.NamedParameters != null) && (parameters.NamedParameters.Keys.Count > 0)) - throw new AssertionFailure(GetType() + " must override to handle implementation of named parameter locations"); - } - /// <summary> /// Fetch a <c>IDbCommand</c>, call <c>SetMaxRows</c> and then execute it, /// advance to the first result and return an SQL <c>IDataReader</c> @@ -1734,6 +1724,7 @@ for (int index = 0; index < parameters.PositionalParameterTypes.Length; index++) { int location = parameters.PositionalParameterLocations[index]; + location = parameters.FindAdjustedParameterLocation(location); IType type = parameters.PositionalParameterTypes[index]; ArrayHelper.SafeSetValue(paramTypeList, location, type); span += type.GetColumnSpan(Factory); @@ -1760,6 +1751,7 @@ for (int i = 0; i < locs.Length; i++) { int location = locs[i]; + location = parameters.FindAdjustedParameterLocation(location); // can still clash with positional parameters // could consider throwing an exception to locate problem (NH-1098) Modified: branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate/Param/ParameterTranslationsImpl.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -67,21 +67,6 @@ } } - public void AdjustNamedParameterLocationsForQueryParameters(QueryParameters parameters) - { - // NH Different behaviour NH-1776 - // Analyze all named parameters declared after filters - // in general all named parameters but depend on the complexity of the query (see sub query) - RestoreOriginalParameterLocations(); - foreach (int filterParameterLocation in parameters.FilteredParameterLocations) - { - foreach (ParameterInfo entry in _namedParameters.Values) - { - entry.IncrementLocationAfterFilterLocation(filterParameterLocation); - } - } - } - public int GetOrdinalParameterSqlLocation(int ordinalPosition) { return GetOrdinalParameterInfo(ordinalPosition).SqlLocations[0]; @@ -117,14 +102,6 @@ get { return _ordinalParameters.Length; } } - private void RestoreOriginalParameterLocations() - { - foreach (ParameterInfo entry in _namedParameters.Values) - { - entry.RestoreOriginalParameterLocations(); - } - } - private ParameterInfo GetOrdinalParameterInfo(int ordinalPosition) { // remember that ordinal parameters numbers are 1-based!!! @@ -170,24 +147,5 @@ } public IType ExpectedType { get; private set; } - - public void RestoreOriginalParameterLocations() - { - for (int i = 0; i < sqlLocations.Length; i++) - { - sqlLocations[i] = originalLocation[i]; - } - } - - public void IncrementLocationAfterFilterLocation(int filterParameterLocation) - { - for (int i = 0; i < sqlLocations.Length; i++) - { - if (sqlLocations[i] >= filterParameterLocation) - { - sqlLocations[i]++; - } - } - } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety +{ + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void UsingFiltersIsThreadSafe() + { + var errors = new List<Exception>(); + var threads = new List<Thread>(); + for (int i = 0; i < 50; i++) + { + var thread = new Thread(() => + { + try + { + ScenarioRunningWithMultiThreading(); + } + catch (Exception ex) + { + lock (errors) + errors.Add(ex); + } + }); + thread.Start(); + threads.Add(thread); + } + + foreach (var thread in threads) + { + thread.Join(); + } + + Assert.AreEqual(0, errors.Count); + } + + private void ScenarioRunningWithMultiThreading() + { + using (var session = sessions.OpenSession()) + { + session + .EnableFilter("CurrentOnly") + .SetParameter("date", DateTime.Now); + + session.CreateQuery( + @" + select u + from Order u + left join fetch u.ActiveOrderLines + where + u.Email = :email + ") + .SetString("email", "st...@bu...") + .UniqueResult<Order>(); + } + } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Mappings.hbm.xml 2009-09-15 21:39:54 UTC (rev 4713) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1908ThreadSafety"> + + <class name="Order" table="Orders"> + <id name="Id" type="Int64" unsaved-value="none"> + <generator class="assigned"/> + </id> + <property name="Email" type="String" not-null="true"/> + <bag name="ActiveOrderLines" inverse="true" cascade="none" lazy="true" + optimistic-lock="false"> + <key column="OrderId"/> + <one-to-many class="OrderLine"/> + <filter name="CurrentOnly"/> + </bag> + </class> + + <class name="OrderLine" discriminator-value="null"> + <id name="Id" type="Int64" unsaved-value="none"> + <generator class="assigned"/> + </id> + <property name="ValidUntil"/> + <filter name="CurrentOnly"/> + </class> + + <filter-def name="CurrentOnly" condition="ValidUntil > :date"> + <filter-param name="date" type="DateTime"/> + </filter-def> +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Model.cs 2009-09-15 21:39:54 UTC (rev 4713) @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety +{ + public class Order + { + public virtual long Id { get; set; } + public virtual IList<OrderLine> ActiveOrderLines { get; set;} + public virtual string Email { get; set; } + } + + public class OrderLine + { + public virtual long Id { get; set; } + public virtual DateTime ValidUntil { get; set; } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 14:26:02 UTC (rev 4712) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 21:39:54 UTC (rev 4713) @@ -361,6 +361,8 @@ <Compile Include="NHSpecificTest\ElementsEnums\Something.cs" /> <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1905\Model.cs" /> + <Compile Include="NHSpecificTest\NH1908ThreadSafety\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1908ThreadSafety\Model.cs" /> <Compile Include="NHSpecificTest\NH1911\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1911\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> @@ -1979,6 +1981,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1938\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aye...@us...> - 2009-09-16 01:57:47
|
Revision: 4715 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4715&view=rev Author: ayenderahien Date: 2009-09-16 01:57:36 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Fixing NHibernate's ability to use Criteria Queries on composites. Based in part on an unapplied patch from David Mansfield for Hibernate Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SessionFactoryHelperExtensions.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -17,6 +17,7 @@ { private readonly ISessionFactoryImplementor _sfi; private readonly NullableDictionary<string, IPropertyMapping> _collectionPropertyMappingByRole; + private readonly SessionFactoryHelper helper; /// <summary> /// Construct a new SessionFactoryHelperExtensions instance. @@ -25,6 +26,7 @@ public SessionFactoryHelperExtensions(ISessionFactoryImplementor sfi) { _sfi = sfi; + helper = new SessionFactoryHelper(_sfi); _collectionPropertyMappingByRole = new NullableDictionary<string, IPropertyMapping>(); } @@ -251,7 +253,7 @@ /// <returns>The defined persister for this class, or null if none found.</returns> private static IQueryable FindQueryableUsingImports(ISessionFactoryImplementor sfi, string className) { - return SessionFactoryHelper.FindQueryableUsingImports(sfi, className); + return new SessionFactoryHelper(sfi).FindQueryableUsingImports(className); } /// <summary> @@ -261,7 +263,7 @@ /// <returns>The defined persister for this entity, or null if none found.</returns> private IEntityPersister FindEntityPersisterByName(string name) { - return SessionFactoryHelper.FindEntityPersisterUsingImports(_sfi, name); + return helper.FindEntityPersisterUsingImports(name); } /// <summary> Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -537,7 +537,7 @@ internal IQueryable GetPersisterUsingImports(string className) { - return SessionFactoryHelper.FindQueryableUsingImports(Factory, className); + return helper.FindQueryableUsingImports(className); } internal IQueryable GetPersister(string clazz) @@ -1320,7 +1320,7 @@ return result; } - public static string[] ConcreteQueries(string query, ISessionFactoryImplementor factory) + public string[] ConcreteQueries(string query, ISessionFactoryImplementor factory) { // TODO H3.2 check if the QuerySplitter can do the work (this method is not present in H3.2) @@ -1374,7 +1374,7 @@ ((last != null && beforeClassTokens.Contains(last)) && (next == null || !notAfterClassTokens.Contains(next))) || PathExpressionParser.EntityClass.Equals(last)) { - System.Type clazz = SessionFactoryHelper.GetImportedClass(factory, token); + System.Type clazz = helper.GetImportedClass(token); if (clazz != null) { string[] implementors = factory.GetImplementors(clazz.FullName); Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/SelectParser.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -35,6 +35,7 @@ public void Token(string token, QueryTranslator q) { + SessionFactoryHelper helper = new SessionFactoryHelper(q.Factory); string lctoken = token.ToLowerInvariant(); if (first) @@ -55,7 +56,7 @@ if (afterNew) { afterNew = false; - holderClass = SessionFactoryHelper.GetImportedClass(q.Factory, token); + holderClass = helper.GetImportedClass(token); if (holderClass == null) { throw new QueryException("class not found: " + token); Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Classic/WhereParser.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -463,6 +463,7 @@ private void DoToken(string token, QueryTranslator q) { + SessionFactoryHelper helper = new SessionFactoryHelper(q.Factory); if (q.IsName(StringHelper.Root(token))) //path expression { DoPathExpression(q.Unalias(token), q); @@ -508,7 +509,7 @@ { fieldName = StringHelper.Unqualify(token); string typeName = StringHelper.Qualifier(token); - importedType = SessionFactoryHelper.GetImportedClass(q.Factory, typeName); + importedType = helper.GetImportedClass(typeName); } if (indexOfDot > -1 && importedType != null && Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/QuerySplitter.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -46,6 +46,8 @@ //TODO: this is one of the ugliest and most fragile pieces of code in Hibernate.... + SessionFactoryHelper helper = new SessionFactoryHelper(factory); + string[] tokens = StringHelper.Split(StringHelper.WhiteSpace + "(),", query, true); if (tokens.Length == 0) { @@ -95,7 +97,7 @@ (next == null || !notAfterClassTokens.Contains(next))) || PathExpressionParser.EntityClass.Equals(last)) { - System.Type clazz = SessionFactoryHelper.GetImportedClass(factory, token); + System.Type clazz = helper.GetImportedClass(token); if (clazz != null) { string[] implementors = factory.GetImplementors(clazz.FullName); Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Util/SessionFactoryHelper.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -1,4 +1,8 @@ +using System; +using System.Collections.Generic; using NHibernate.Engine; +using NHibernate.Hql.Ast.ANTLR; +using NHibernate.Persister.Collection; using NHibernate.Persister.Entity; using NHibernate.Util; @@ -9,13 +13,22 @@ /// </summary> public class SessionFactoryHelper { - public static IQueryable FindQueryableUsingImports(ISessionFactoryImplementor sfi, string className) + private readonly ISessionFactoryImplementor sfi; + private readonly IDictionary<string,CollectionPropertyMapping> collectionPropertyMappingByRole = + new Dictionary<string,CollectionPropertyMapping>(); + + public SessionFactoryHelper(ISessionFactoryImplementor sfi) { - return FindEntityPersisterUsingImports(sfi, className) as IQueryable; + this.sfi = sfi; } - public static IEntityPersister FindEntityPersisterUsingImports(ISessionFactoryImplementor sfi, string className) + public IQueryable FindQueryableUsingImports(string className) { + return FindEntityPersisterUsingImports(className) as IQueryable; + } + + public IEntityPersister FindEntityPersisterUsingImports(string className) + { // NH : short cut if (string.IsNullOrEmpty(className)) { @@ -61,8 +74,75 @@ return TypeNameParser.Parse(assemblyQualifiedName).Type; } - public static System.Type GetImportedClass(ISessionFactoryImplementor sfi, string className) + + + /// <summary> + /// Locate the collection persister by the collection role. + /// </summary> + /// <param name="role">The collection role name.</param> + /// <returns>The defined CollectionPersister for this collection role, or null.</returns> + public IQueryableCollection GetCollectionPersister(String role) { + try + { + return (IQueryableCollection)sfi.GetCollectionPersister(role); + } + catch (InvalidCastException cce) + { + throw new QueryException("collection is not queryable: " + role); + } + catch (Exception e) + { + throw new QueryException("collection not found: " + role); + } + } + + /// <summary> + /// Locate the persister by class or entity name, requiring that such a persister + /// exists + /// </summary> + /// <param name="name">The class or entity name</param> + /// <returns>The defined persister for this entity</returns> + public IEntityPersister RequireClassPersister(String name) + { + IEntityPersister cp = FindEntityPersisterByName(name); + if (cp == null) + { + throw new QuerySyntaxException(name + " is not mapped"); + } + + return cp; + } + + /// <summary> + /// Locate the persister by class or entity name. + /// </summary> + /// <param name="name">The class or entity name</param> + /// <returns>The defined persister for this entity, or null if none found.</returns> + private IEntityPersister FindEntityPersisterByName(String name) + { + // First, try to get the persister using the given name directly. + try + { + return sfi.GetEntityPersister(name); + } + catch (MappingException ignore) + { + // unable to locate it using this name + } + + // If that didn't work, try using the 'import' name. + String importedClassName = sfi.GetImportedClassName(name); + if (importedClassName == null) + { + return null; + } + return sfi.GetEntityPersister(importedClassName); + } + + + public System.Type GetImportedClass(string className) + { string importedName = sfi.GetImportedClassName(className); if (importedName == null) @@ -73,5 +153,49 @@ // NH Different implementation: our sessionFactory.Imports hold AssemblyQualifiedName return System.Type.GetType(importedName, false); } + + + /// <summary> + /// Retreive a PropertyMapping describing the given collection role. + /// </summary> + /// <param name="role">The collection role for whcih to retrieve the property mapping.</param> + /// <returns>The property mapping.</returns> + public IPropertyMapping GetCollectionPropertyMapping(String role) + { + return collectionPropertyMappingByRole[role]; + } + + + /* Locate the collection persister by the collection role, requiring that + * such a persister exist. + * + * @param role The collection role name. + * @return The defined CollectionPersister for this collection role. + * @throws QueryException Indicates that the collection persister could not be found. + */ + public IQueryableCollection RequireQueryableCollection(String role) + { + try + { + IQueryableCollection queryableCollection = (IQueryableCollection)sfi + .GetCollectionPersister(role); + if (queryableCollection != null) + { + collectionPropertyMappingByRole.Add(role, + new CollectionPropertyMapping(queryableCollection)); + } + return queryableCollection; + } + catch (InvalidCastException) + { + throw new QueryException( + "collection role is not queryable: " + role); + } + catch (Exception) + { + throw new QueryException("collection role not found: " + + role); + } + } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ComponentCollectionCriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using NHibernate.Persister.Collection; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public class ComponentCollectionCriteriaInfoProvider : ICriteriaInfoProvider + { + private readonly IQueryableCollection persister; + private readonly IDictionary<String, IType> subTypes = new Dictionary<string, IType>(); + + public ComponentCollectionCriteriaInfoProvider(IQueryableCollection persister) + { + this.persister = persister; + if (!persister.ElementType.IsComponentType) + { + throw new ArgumentException("persister for role " + persister.Role + " is not a collection-of-component"); + } + + var componentType = (ComponentType)persister.ElementType; + var names = componentType.PropertyNames; + var types = componentType.Subtypes; + + for (var i = 0; i < names.Length; i++) + { + subTypes.Add(names[i], types[i]); + } + + } + + public String Name + { + get + { + return persister.Role; + } + } + + public string[] Spaces + { + get + { + return persister.CollectionSpaces; + } + } + + public IPropertyMapping PropertyMapping + { + get + { + return persister; + } + } + + public IType GetType(String relativePath) + { + // TODO: can a component have a nested component? then we may need to do something more here... + if (relativePath.IndexOf('.') >= 0) + throw new ArgumentException("dotted paths not handled (yet?!) for collection-of-component"); + + IType type; + + if (subTypes.TryGetValue(relativePath, out type) == false) + throw new ArgumentException("property " + relativePath + " not found in component of collection " + Name); + + return type; + } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -1,6 +1,8 @@ using System.Collections.Generic; using Iesi.Collections.Generic; +using log4net; using NHibernate.Engine; +using NHibernate.Persister.Collection; using NHibernate.Persister.Entity; using NHibernate.SqlCommand; using NHibernate.Type; @@ -25,6 +27,8 @@ private readonly string[] userAliases; private readonly IList<string> userAliasList = new List<string>(); + private static readonly ILog logger = LogManager.GetLogger(typeof (CriteriaJoinWalker)); + public CriteriaJoinWalker(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, string rootEntityName, IDictionary<string, IFilter> enabledFilters) @@ -126,8 +130,15 @@ protected override string GenerateTableAlias(int n, string path, IJoinable joinable) { - if (joinable.ConsumesEntityAlias()) + bool shouldCreateUserAlias = joinable.ConsumesEntityAlias(); + if(shouldCreateUserAlias == false && joinable.IsCollection) { + var elementType = ((ICollectionPersister)joinable).ElementType; + if (elementType != null) + shouldCreateUserAlias = elementType.IsComponentType; + } + if (shouldCreateUserAlias) + { ICriteria subcriteria = translator.GetCriteria(path); string sqlAlias = subcriteria == null ? null : translator.GetSQLAlias(subcriteria); if (sqlAlias != null) @@ -135,10 +146,8 @@ userAliasList.Add(subcriteria.Alias); //alias may be null return sqlAlias; //EARLY EXIT } - else - { - userAliasList.Add(null); - } + + userAliasList.Add(null); } return base.GenerateTableAlias(n + translator.SQLAliasCount, path, joinable); } Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using Iesi.Collections.Generic; +using log4net; using NHibernate.Criterion; using NHibernate.Engine; using NHibernate.Hql.Util; @@ -24,9 +25,14 @@ private readonly CriteriaImpl rootCriteria; private readonly string rootEntityName; private readonly string rootSQLAlias; - private readonly int aliasCount = 0; + private const int aliasCount = 0; - private readonly IDictionary<ICriteria, string> criteriaEntityNames = new LinkedHashMap<ICriteria, string>(); + private readonly IDictionary<ICriteria, ICriteriaInfoProvider> criteriaInfoMap = + new Dictionary<ICriteria, ICriteriaInfoProvider>(); + + private readonly IDictionary<String, ICriteriaInfoProvider> nameCriteriaInfoMap = + new Dictionary<string, ICriteriaInfoProvider>(); + private readonly ISet<ICollectionPersister> criteriaCollectionPersisters = new HashedSet<ICollectionPersister>(); private readonly IDictionary<ICriteria, string> criteriaSQLAliasMap = new Dictionary<ICriteria, string>(); @@ -36,23 +42,26 @@ private readonly ISessionFactoryImplementor sessionFactory; private int indexForAlias = 0; + private static readonly ILog logger = LogManager.GetLogger(typeof(CriteriaQueryTranslator)); private readonly List<TypedValue> usedTypedValues = new List<TypedValue>(); + private SessionFactoryHelper helper; public CriteriaQueryTranslator(ISessionFactoryImplementor factory, CriteriaImpl criteria, string rootEntityName, - string rootSQLAlias, ICriteriaQuery outerQuery) + string rootSQLAlias, ICriteriaQuery outerQuery) : this(factory, criteria, rootEntityName, rootSQLAlias) { outerQueryTranslator = outerQuery; } public CriteriaQueryTranslator(ISessionFactoryImplementor factory, CriteriaImpl criteria, string rootEntityName, - string rootSQLAlias) + string rootSQLAlias) { rootCriteria = criteria; this.rootEntityName = rootEntityName; sessionFactory = factory; this.rootSQLAlias = rootSQLAlias; + helper = new SessionFactoryHelper(factory); CreateAliasCriteriaMap(); CreateAssociationPathCriteriaMap(); @@ -62,7 +71,7 @@ } [CLSCompliant(false)] // TODO: Why does this cause a problem in 1.1 - public string RootSQLAlias + public string RootSQLAlias { get { return rootSQLAlias; } } @@ -71,9 +80,9 @@ { ISet<string> result = new HashedSet<string>(); - foreach (string entityName in criteriaEntityNames.Values) + foreach (ICriteriaInfoProvider info in criteriaInfoMap.Values) { - result.AddAll(Factory.GetEntityPersister(entityName).QuerySpaces); + result.AddAll(info.Spaces); } foreach (ICollectionPersister collectionPersister in criteriaCollectionPersisters) @@ -131,7 +140,7 @@ return new QueryParameters(typeArray, valueArray, lockModes, selection, rootCriteria.Cacheable, rootCriteria.CacheRegion, - rootCriteria.Comment, rootCriteria.LookupByNaturalKey, rootCriteria.ResultTransformer); + rootCriteria.Comment, rootCriteria.LookupByNaturalKey, rootCriteria.ResultTransformer); } public SqlString GetGroupBy() @@ -140,7 +149,7 @@ { return rootCriteria.Projection.ToGroupSqlString(rootCriteria.ProjectionCriteria, this, - new CollectionHelper.EmptyMapClass<string, IFilter>()); + new CollectionHelper.EmptyMapClass<string, IFilter>()); } else { @@ -245,6 +254,7 @@ { ICriteria result; associationPathCriteriaMap.TryGetValue(path, out result); + logger.DebugFormat("getCriteria for path={0} crit={1}", path, result); return result; } @@ -330,33 +340,119 @@ else { // otherwise, recurse - return GetWholeAssociationPath((CriteriaImpl.Subcriteria) parent) + '.' + path; + return GetWholeAssociationPath((CriteriaImpl.Subcriteria)parent) + '.' + path; } } private void CreateCriteriaEntityNameMap() { - criteriaEntityNames[rootCriteria] = rootEntityName; + // initialize the rootProvider first + ICriteriaInfoProvider rootProvider = new EntityCriteriaInfoProvider((IQueryable)sessionFactory.GetEntityPersister(rootEntityName)); + criteriaInfoMap.Add(rootCriteria, rootProvider); + nameCriteriaInfoMap.Add(rootProvider.Name, rootProvider); + foreach (KeyValuePair<string, ICriteria> me in associationPathCriteriaMap) { - criteriaEntityNames[me.Value] = GetPathEntityName(me.Key); + ICriteriaInfoProvider info = GetPathInfo(me.Key); + criteriaInfoMap.Add(me.Value, info); + nameCriteriaInfoMap[info.Name] = info; } } - private string GetPathEntityName(string path) + + private void CreateCriteriaCollectionPersisters() { - IQueryable persister = (IQueryable) sessionFactory.GetEntityPersister(rootEntityName); + foreach (KeyValuePair<string, ICriteria> me in associationPathCriteriaMap) + { + IJoinable joinable = GetPathJoinable(me.Key); + if (joinable != null && joinable.IsCollection) + { + criteriaCollectionPersisters.Add((ICollectionPersister)joinable); + } + } + } + + private IJoinable GetPathJoinable(string path) + { + IJoinable last = (IJoinable)Factory.GetEntityPersister(rootEntityName); + IPropertyMapping lastEntity = (IPropertyMapping)last; + + string componentPath = ""; + StringTokenizer tokens = new StringTokenizer(path, ".", false); + foreach (string token in tokens) + { + componentPath += token; + IType type = lastEntity.ToType(componentPath); + if (type.IsAssociationType) + { + if(type.IsCollectionType) + { + // ignore joinables for composite collections + var collectionType = (CollectionType)type; + var persister = Factory.GetCollectionPersister(collectionType.Role); + if(persister.ElementType.IsEntityType==false) + return null; + } + IAssociationType atype = (IAssociationType)type; + + last = atype.GetAssociatedJoinable(Factory); + lastEntity = (IPropertyMapping)Factory.GetEntityPersister(atype.GetAssociatedEntityName(Factory)); + componentPath = ""; + } + else if (type.IsComponentType) + { + componentPath += '.'; + } + else + { + throw new QueryException("not an association: " + componentPath); + } + } + return last; + } + + private ICriteriaInfoProvider GetPathInfo(string path) + { + StringTokenizer tokens = new StringTokenizer(path, ".", false); string componentPath = string.Empty; + + // start with the 'rootProvider' + ICriteriaInfoProvider provider; + if (nameCriteriaInfoMap.TryGetValue(rootEntityName, out provider) == false) + throw new ArgumentException("Could not find ICriteriaInfoProvider for: " + path); + + foreach (string token in tokens) { componentPath += token; - IType type = persister.ToType(componentPath); + logger.DebugFormat("searching for {0}", componentPath); + IType type = provider.GetType(componentPath); if (type.IsAssociationType) { - IAssociationType atype = (IAssociationType) type; - persister = (IQueryable) sessionFactory.GetEntityPersister(atype.GetAssociatedEntityName(sessionFactory)); + // CollectionTypes are always also AssociationTypes - but there's not always an associated entity... + IAssociationType atype = (IAssociationType)type; + + CollectionType ctype = type.IsCollectionType ? (CollectionType)type : null; + IType elementType = (ctype != null) ? ctype.GetElementType(sessionFactory) : null; + // is the association a collection of components or value-types? (i.e a colloction of valued types?) + if (ctype != null && elementType.IsComponentType) + { + provider = new ComponentCollectionCriteriaInfoProvider(helper.GetCollectionPersister(ctype.Role)); + } + else if (ctype != null && !elementType.IsEntityType) + { + provider = new ScalarCollectionCriteriaInfoProvider(helper, ctype.Role); + } + else + { + provider = new EntityCriteriaInfoProvider((IQueryable)sessionFactory.GetEntityPersister( + atype.GetAssociatedEntityName( + sessionFactory) + )); + } + componentPath = string.Empty; } else if (type.IsComponentType) @@ -368,22 +464,27 @@ throw new QueryException("not an association: " + componentPath); } } - return persister.EntityName; + + logger.DebugFormat("returning entity name={0} for path={1} class={2}", + provider.Name, path, provider.GetType().Name); + return provider; } private void CreateCriteriaSQLAliasMap() { int i = 0; - foreach (KeyValuePair<ICriteria, string> me in criteriaEntityNames) + foreach (KeyValuePair<ICriteria, ICriteriaInfoProvider> me in criteriaInfoMap) { ICriteria crit = me.Key; string alias = crit.Alias; if (alias == null) { - alias = me.Value; // the entity name + alias = me.Value.Name; // the entity name } criteriaSQLAliasMap[crit] = StringHelper.GenerateAlias(alias, i++); + logger.DebugFormat("put criteria={0} alias={1}", + crit, criteriaSQLAliasMap[crit]); } criteriaSQLAliasMap[rootCriteria] = rootSQLAlias; } @@ -395,14 +496,17 @@ public string GetSQLAlias(ICriteria criteria) { - return criteriaSQLAliasMap[criteria]; + String alias = criteriaSQLAliasMap[criteria]; + logger.DebugFormat("returning alias={0} for criteria={1}", alias, criteria); + return alias; } public string GetEntityName(ICriteria criteria) { - string result; - criteriaEntityNames.TryGetValue(criteria, out result); - return result; + ICriteriaInfoProvider result; + if(criteriaInfoMap.TryGetValue(criteria, out result)==false) + throw new ArgumentException("Could not find a matching criteria info provider to: " + criteria); + return result.Name; } public string GetColumn(ICriteria criteria, string propertyName) @@ -442,18 +546,18 @@ public string[] GetIdentifierColumns(ICriteria subcriteria) { - string[] idcols = ((ILoadable) GetPropertyMapping(GetEntityName(subcriteria))).IdentifierColumnNames; + string[] idcols = ((ILoadable)GetPropertyMapping(GetEntityName(subcriteria))).IdentifierColumnNames; return StringHelper.Qualify(GetSQLAlias(subcriteria), idcols); } public IType GetIdentifierType(ICriteria subcriteria) { - return ((ILoadable) GetPropertyMapping(GetEntityName(subcriteria))).IdentifierType; + return ((ILoadable)GetPropertyMapping(GetEntityName(subcriteria))).IdentifierType; } public TypedValue GetTypedIdentifierValue(ICriteria subcriteria, object value) { - ILoadable loadable = (ILoadable) GetPropertyMapping(GetEntityName(subcriteria)); + ILoadable loadable = (ILoadable)GetPropertyMapping(GetEntityName(subcriteria)); return new TypedValue(loadable.IdentifierType, value, EntityMode.Poco); } @@ -518,8 +622,8 @@ // Detect discriminator values... if (value is System.Type) { - System.Type entityClass = (System.Type) value; - IQueryable q = SessionFactoryHelper.FindQueryableUsingImports(sessionFactory, entityClass.FullName); + System.Type entityClass = (System.Type)value; + IQueryable q = helper.FindQueryableUsingImports(entityClass.FullName); if (q != null) { @@ -533,7 +637,10 @@ private IPropertyMapping GetPropertyMapping(string entityName) { - return (IPropertyMapping) sessionFactory.GetEntityPersister(entityName); + ICriteriaInfoProvider info ; + if (nameCriteriaInfoMap.TryGetValue(entityName, out info)==false) + throw new InvalidOperationException("Could not find criteria info provider for: " + entityName); + return info.PropertyMapping; } public string GetEntityName(ICriteria subcriteria, string propertyName) @@ -600,49 +707,7 @@ } } - private void CreateCriteriaCollectionPersisters() - { - foreach (KeyValuePair<string, ICriteria> me in associationPathCriteriaMap) - { - IJoinable joinable = GetPathJoinable(me.Key); - if (joinable.IsCollection) - { - criteriaCollectionPersisters.Add((ICollectionPersister) joinable); - } - } - } - private IJoinable GetPathJoinable(string path) - { - IJoinable last = (IJoinable) Factory.GetEntityPersister(rootEntityName); - IPropertyMapping lastEntity = (IPropertyMapping) last; - - string componentPath = ""; - - StringTokenizer tokens = new StringTokenizer(path, ".", false); - foreach (string token in tokens) - { - componentPath += token; - IType type = lastEntity.ToType(componentPath); - if (type.IsAssociationType) - { - IAssociationType atype = (IAssociationType) type; - last = atype.GetAssociatedJoinable(Factory); - lastEntity = (IPropertyMapping) Factory.GetEntityPersister(atype.GetAssociatedEntityName(Factory)); - componentPath = ""; - } - else if (type.IsComponentType) - { - componentPath += '.'; - } - else - { - throw new QueryException("not an association: " + componentPath); - } - } - return last; - } - public SqlString GetHavingCondition(IDictionary<string, IFilter> enabledFilters) { SqlStringBuilder condition = new SqlStringBuilder(30); Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/EntityCriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,45 @@ +using System; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public class EntityCriteriaInfoProvider : ICriteriaInfoProvider + { + readonly IQueryable persister; + + public EntityCriteriaInfoProvider(IQueryable persister) + { + this.persister = persister; + } + + public String Name + { + get + { + return persister.EntityName; + } + } + + public string[] Spaces + { + get + { + return persister.QuerySpaces; + } + } + + public IPropertyMapping PropertyMapping + { + get + { + return persister; + } + } + + public IType GetType(String relativePath) + { + return persister.ToType(relativePath); + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ICriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,14 @@ +using System; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public interface ICriteriaInfoProvider + { + string Name { get; } + string[] Spaces { get; } + IPropertyMapping PropertyMapping { get; } + IType GetType(String relativePath); + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/ScalarCollectionCriteriaInfoProvider.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,52 @@ +using System; +using NHibernate.Hql.Util; +using NHibernate.Persister.Collection; +using NHibernate.Persister.Entity; +using NHibernate.Type; + +namespace NHibernate.Loader.Criteria +{ + public class ScalarCollectionCriteriaInfoProvider : ICriteriaInfoProvider + { + private readonly String role; + private readonly IQueryableCollection persister; + private readonly SessionFactoryHelper helper; + public ScalarCollectionCriteriaInfoProvider(SessionFactoryHelper helper, String role) + { + this.role = role; + this.helper = helper; + this.persister = helper.RequireQueryableCollection(role); + } + + public String Name + { + get + { + return role; + } + } + + public string[] Spaces + { + get + { + return persister.CollectionSpaces; + } + } + + public IPropertyMapping PropertyMapping + { + get + { + return helper.GetCollectionPropertyMapping(role); + } + } + + public IType GetType(String relativePath) + { + //not sure what things are going to be passed here, how about 'id', maybe 'index' or 'key' or 'elements' ??? + return PropertyMapping.ToType(relativePath); + } + + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -783,7 +783,6 @@ else { SqlStringBuilder buf = new SqlStringBuilder(associations.Count * 3); - buf.Add(StringHelper.CommaSpace); int entityAliasCount = 0; int collectionAliasCount = 0; @@ -804,16 +803,16 @@ joinable.SelectFragment(next == null ? null : next.Joinable, next == null ? null : next.RHSAlias, join.RHSAlias, entitySuffix, collectionSuffix, join.JoinType == JoinType.LeftOuterJoin); - buf.Add(selectFragment); - + if (selectFragment.Trim().Length > 0) + { + buf.Add(StringHelper.CommaSpace) + .Add(selectFragment); + } if (joinable.ConsumesEntityAlias()) entityAliasCount++; if (joinable.ConsumesCollectionAlias() && join.JoinType == JoinType.LeftOuterJoin) collectionAliasCount++; - - if (i < associations.Count - 1 && selectFragment.Trim().Length > 0) - buf.Add(StringHelper.CommaSpace); } return buf.ToSqlString().ToString(); Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Loader.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -13,6 +13,7 @@ using NHibernate.Engine; using NHibernate.Event; using NHibernate.Exceptions; +using NHibernate.Hql.Util; using NHibernate.Impl; using NHibernate.Persister.Collection; using NHibernate.Persister.Entity; @@ -48,10 +49,12 @@ private readonly ISessionFactoryImplementor factory; private ColumnNameCache columnNameCache; + protected SessionFactoryHelper helper; public Loader(ISessionFactoryImplementor factory) { this.factory = factory; + helper = new SessionFactoryHelper(factory); } /// <summary> Modified: branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-09-16 01:57:36 UTC (rev 4715) @@ -514,6 +514,10 @@ <Compile Include="Hql\Ast\ANTLR\Tree\InsertStatement.cs" /> <Compile Include="Hql\Ast\ANTLR\Tree\UpdateStatement.cs" /> <Compile Include="Impl\SessionIdLoggingContext.cs" /> + <Compile Include="Loader\Criteria\ComponentCollectionCriteriaInfoProvider.cs" /> + <Compile Include="Loader\Criteria\EntityCriteriaInfoProvider.cs" /> + <Compile Include="Loader\Criteria\ICriteriaInfoProvider.cs" /> + <Compile Include="Loader\Criteria\ScalarCollectionCriteriaInfoProvider.cs" /> <Compile Include="Param\AbstractExplicitParameterSpecification.cs" /> <Compile Include="Param\AggregatedIndexCollectionSelectorParameterSpecifications.cs" /> <Compile Include="Param\CollectionFilterKeyParameterSpecification.cs" /> Property changes on: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Employee.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection +{ + public class Employee + { + public virtual int Id { get; set; } + public virtual ICollection<Money> Amounts { get; set; } + public virtual ICollection<ManagedEmployee> ManagedEmployees { get; set; } + } + + public class ManagedEmployee + { + public virtual Employee Employee { get; set; } + public virtual string Position { get; set; } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Fixture.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,118 @@ +using System.Collections; +using Iesi.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Criterion; +using NHibernate.Transform; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection +{ + [TestFixture] + public class Fixture : TestCase + { + protected override void Configure(Configuration configuration) + { + configuration.SetProperty(Environment.FormatSql, "false"); + } + + protected override void OnSetUp() + { + using (var s = sessions.OpenSession()) + using (s.BeginTransaction()) + { + var parent = new Employee + { + Id = 2, + }; + var emp = new Employee + { + Id = 1, + Amounts = new HashedSet<Money> + { + new Money {Amount = 9, Currency = "USD"}, + new Money {Amount = 3, Currency = "EUR"}, + }, + ManagedEmployees = new HashedSet<ManagedEmployee> + { + new ManagedEmployee + { + Position = "parent", + Employee = parent + } + } + }; + s.Save(parent); + s.Save(emp); + + s.Transaction.Commit(); + } + } + + protected override void OnTearDown() + { + using (var s = sessions.OpenSession()) + using(s.BeginTransaction()) + { + s.Delete("from System.Object"); + + s.Transaction.Commit(); + } + } + + [Test] + public void CanQueryByCriteriaOnSetOfCompositeElement() + { + using(var s = sessions.OpenSession()) + { + var list = s.CreateCriteria<Employee>() + .CreateCriteria("ManagedEmployees") + .Add(Restrictions.Eq("Position", "parent")) + .SetResultTransformer(new RootEntityResultTransformer()) + .List(); + Assert.IsNotEmpty(list); + } + } + + [Test] + public void CanQueryByCriteriaOnSetOfElement() + { + using (var s = sessions.OpenSession()) + { + var list = s.CreateCriteria<Employee>() + .CreateCriteria("Amounts") + .Add(Restrictions.Gt("Amount", 5m)) + .SetResultTransformer(new RootEntityResultTransformer()) + .List(); + Assert.IsNotEmpty(list); + } + } + + [Test] + public void CanQueryByCriteriaOnSetOfCompositeElement_UsingDetachedCriteria() + { + using (var s = sessions.OpenSession()) + { + var list = s.CreateCriteria<Employee>() + .Add(Subqueries.PropertyIn("id", + DetachedCriteria.For<Employee>() + .SetProjection(Projections.Id()) + .CreateCriteria("Amounts") + .Add(Restrictions.Gt("Amount", 5m)))) + .List(); + Assert.IsNotEmpty(list); + } + } + + + protected override IList Mappings + { + get { return new [] { "NHSpecificTest.CriteriaQueryOnComponentCollection.Mappings.hbm.xml" }; } + } + + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Mappings.hbm.xml 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection" + assembly="NHibernate.Test"> + + <class name="Employee" table="Employees" lazy="false"> + <id name="Id" type="Int32"> + <generator class="assigned" /> + </id> + + <set name="Amounts" table="Amounts"> + <key column="EmployeeId"/> + <composite-element class="Money"> + <property name="Amount" type="Decimal" not-null="true"/> + <property name="Currency" type="String" not-null="true"/> + </composite-element> + </set> + + <set name="ManagedEmployees" table="ManagedEmployees"> + <key column="EmployeeId"/> + <composite-element class="ManagedEmployee"> + <property name="Position" type="string" not-null="true"/> + <many-to-one name="Employee" class="Employee"/> + </composite-element> + </set> + + </class> +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/CriteriaQueryOnComponentCollection/Money.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -0,0 +1,8 @@ +namespace NHibernate.Test.NHSpecificTest.CriteriaQueryOnComponentCollection +{ + public class Money + { + public virtual string Currency { get; set; } + public virtual decimal Amount { get; set; } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH830/AutoFlushTestFixture.cs 2009-09-16 01:57:36 UTC (rev 4715) @@ -20,13 +20,13 @@ sess.Flush(); //reload the data and then setup the many-to-many association - mum = (Cat) sess.Get(typeof(Cat), mum.Id); - son = (Cat) sess.Get(typeof(Cat), son.Id); + mum = (Cat) sess.Get(typeof (Cat), mum.Id); + son = (Cat) sess.Get(typeof (Cat), son.Id); mum.Children.Add(son); son.Parents.Add(mum); //Use criteria API to search first - IList result = sess.CreateCriteria(typeof(Cat)) + IList result = sess.CreateCriteria(typeof (Cat)) .CreateAlias("Children", "child") .Add(Expression.Eq("child.Id", son.Id)) .List(); Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-15 21:41:03 UTC (rev 4714) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-16 01:57:36 UTC (rev 4715) @@ -46,6 +46,10 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\..\lib\net\2.0\Antlr3.Runtime.dll</HintPath> </Reference> + <Reference Include="HibernatingRhinos.NHibernate.Profiler.Appender, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0774796e73ebf640, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Hibernating.Rhinos\NHibernate.Profiler\HibernatingRhinos.NHibernate.Profiler.Appender\bin\Debug\HibernatingRhinos.NHibernate.Profiler.Appender.dll</HintPath> + </Reference> <Reference Include="Iesi.Collections, Version=1.0.0.1, Culture=neutral, PublicKeyToken=154fdcb44c4484fc"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\lib\net\2.0\Iesi.Collections.dll</HintPath> @@ -354,6 +358,9 @@ <Compile Include="LazyProperty\LazyPropertyFixture.cs" /> <Compile Include="MappingTest\NonReflectiveBinderFixture.cs" /> <Compile Include="MappingTest\Wicked.cs" /> + <Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Employee.cs" /> + <Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Fixture.cs" /> + <Compile Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Money.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\AbstractIntEnumsBagFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagNoNameFixture.cs" /> <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagPartialNameFixture.cs" /> @@ -1981,6 +1988,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\2_Person.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aye...@us...> - 2009-09-16 02:11:26
|
Revision: 4716 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4716&view=rev Author: ayenderahien Date: 2009-09-16 02:11:15 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Can now use DetachedCriteria with IStatelessSession - NH-1922 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs 2009-09-16 01:57:36 UTC (rev 4715) +++ branches/2.1.x/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs 2009-09-16 02:11:15 UTC (rev 4716) @@ -1,4 +1,5 @@ using System; +using NHibernate.Engine; using NHibernate.Impl; using NHibernate.SqlCommand; using NHibernate.Transform; @@ -65,6 +66,15 @@ return impl; } + /// <summary> + /// Get an executable instance of <c>Criteria</c>, + /// to actually run the query.</summary> + public ICriteria GetExecutableCriteria(IStatelessSession session) + { + impl.Session = (ISessionImplementor)session; + return impl; + } + public static DetachedCriteria For(System.Type entityType) { return new DetachedCriteria(entityType); Property changes on: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922 ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Fixture.cs 2009-09-16 02:11:15 UTC (rev 4716) @@ -0,0 +1,56 @@ +using System; +using NHibernate.Criterion; +using NHibernate.SqlCommand; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1922 +{ + [TestFixture] + public class Fixture : BugTestCase + { protected override void OnSetUp() + { + base.OnSetUp(); + using (ISession session = OpenSession()) + { + using (ITransaction tx = session.BeginTransaction()) + { + var joe = new Customer() {ValidUntil = new DateTime(2000,1,1)}; + session.Save(joe); + + tx.Commit(); + } + } + } + + protected override void OnTearDown() + { + using (ISession session = OpenSession()) + { + using (ITransaction tx = session.BeginTransaction()) + { + session.Delete("from Customer"); + tx.Commit(); + } + } + base.OnTearDown(); + } + + + [Test] + public void CanExecuteQueryOnStatelessSessionUsingDetachedCriteria() + { + using(var stateless = sessions.OpenStatelessSession()) + { + var dc = DetachedCriteria.For<Customer>() + .Add(Restrictions.Eq("ValidUntil", new DateTime(2000,1,1))); + + var cust = dc.GetExecutableCriteria(stateless) + .UniqueResult(); + + Assert.IsNotNull(cust); + } + } + + + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Mappings.hbm.xml 2009-09-16 02:11:15 UTC (rev 4716) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1922"> + + <class name="Customer" > + <id name="ID" type="Int32"> + <generator class="hilo" /> + </id> + + <property name="ValidUntil" type="DateTime" /> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1922/Model.cs 2009-09-16 02:11:15 UTC (rev 4716) @@ -0,0 +1,11 @@ +using System; +using Iesi.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1922 +{ + public class Customer + { + public virtual int ID { get; private set; } + public virtual DateTime ValidUntil { get; set; } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-16 01:57:36 UTC (rev 4715) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-16 02:11:15 UTC (rev 4716) @@ -374,6 +374,8 @@ <Compile Include="NHSpecificTest\NH1911\Model.cs" /> <Compile Include="NHSpecificTest\NH1920\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1920\Model.cs" /> + <Compile Include="NHSpecificTest\NH1922\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1922\Model.cs" /> <Compile Include="NHSpecificTest\NH1927\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1927\Model.cs" /> <Compile Include="NHSpecificTest\NH1928\Fixture.cs" /> @@ -1988,6 +1990,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1922\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> <EmbeddedResource Include="Tools\hbm2ddl\SchemaUpdate\1_Person.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-23 10:09:25
|
Revision: 4721 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4721&view=rev Author: ricbrown Date: 2009-09-23 10:09:13 +0000 (Wed, 23 Sep 2009) Log Message: ----------- Fix NH-1941 (Overriding GetValue in EnumStringType) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Type/EnumStringType.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Model.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/SexEnumStringType.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Type/EnumStringType.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Type/EnumStringType.cs 2009-09-21 02:04:47 UTC (rev 4720) +++ branches/2.1.x/nhibernate/src/NHibernate/Type/EnumStringType.cs 2009-09-23 10:09:13 UTC (rev 4721) @@ -126,7 +126,7 @@ public virtual object GetValue(object code) { //code is an enum instance. - return code == null ? string.Empty : code.ToString(); + return code == null ? string.Empty : Enum.Format(ReturnedClass, code, "G"); } /// <summary> @@ -144,7 +144,7 @@ } else { - par.Value = Enum.Format(ReturnedClass, value, "G"); + par.Value = GetValue(value); } } Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Fixture.cs 2009-09-23 10:09:13 UTC (rev 4721) @@ -0,0 +1,50 @@ +using System; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1941 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + protected override void OnTearDown() + { + base.OnTearDown(); + using (ISession s = OpenSession()) + { + s.Delete("from Person"); + } + } + [Test] + public void CanOverrideStringEnumGetValue() + { + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + using (SqlLogSpy ls = new SqlLogSpy()) + { + Person person = new Person() { Sex = Sex.Male }; + s.Save(person); + + string log = ls.GetWholeLog(); + Assert.IsTrue(log.Contains("@p0 = 'M'")); + } + + using (SqlLogSpy ls = new SqlLogSpy()) + { + Person person = + s.CreateQuery("from Person p where p.Sex = :personSex") + .SetParameter("personSex", Sex.Female) + .UniqueResult<Person>(); + + Assert.That(person, Is.Null); + + string log = ls.GetWholeLog(); + Assert.IsTrue(log.Contains("@p0 = 'F'")); + } + + tx.Rollback(); + } + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Mappings.hbm.xml 2009-09-23 10:09:13 UTC (rev 4721) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1941"> + + <class name="Person" > + <id name="Id"> + <generator class="native" /> + </id> + + <property name="Sex" type="SexEnumStringType" /> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/Model.cs 2009-09-23 10:09:13 UTC (rev 4721) @@ -0,0 +1,14 @@ +namespace NHibernate.Test.NHSpecificTest.NH1941 +{ + public enum Sex + { + Male, + Female, + } + + public class Person + { + public virtual int Id { get; set; } + public virtual Sex Sex { get; set; } + } +} Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/SexEnumStringType.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/SexEnumStringType.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1941/SexEnumStringType.cs 2009-09-23 10:09:13 UTC (rev 4721) @@ -0,0 +1,28 @@ +using System; +using NHibernate.Type; + +namespace NHibernate.Test.NHSpecificTest.NH1941 +{ + public class SexEnumStringType : EnumStringType<Sex> + { + public override object GetValue(object enumValue) + { + if (enumValue == null) + { + return string.Empty; + } + + return (Sex)enumValue == Sex.Male ? "M" : "F"; + } + + public override object GetInstance(object value) + { + if (value == null) + { + throw new ArgumentNullException("value"); + } + + return (value.ToString() == "M") ? Sex.Male : Sex.Female; + } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-21 02:04:47 UTC (rev 4720) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-23 10:09:13 UTC (rev 4721) @@ -575,6 +575,9 @@ <Compile Include="NHSpecificTest\NH1938\Model.cs" /> <Compile Include="NHSpecificTest\NH1939\AuxType.cs" /> <Compile Include="NHSpecificTest\NH1939\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1941\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1941\Model.cs" /> + <Compile Include="NHSpecificTest\NH1941\SexEnumStringType.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> <Compile Include="NHSpecificTest\NH473\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Parent.cs" /> @@ -1986,6 +1989,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1941\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1922\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1908ThreadSafety\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-24 11:20:31
|
Revision: 4723 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4723&view=rev Author: ricbrown Date: 2009-09-24 11:20:25 +0000 (Thu, 24 Sep 2009) Log Message: ----------- Fix NH-1948 Allow scale of zero Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2009-09-23 10:10:00 UTC (rev 4722) +++ branches/2.1.x/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2009-09-24 11:20:25 UTC (rev 4723) @@ -152,7 +152,7 @@ public string precision; /// <remarks/> - [System.Xml.Serialization.XmlAttributeAttribute(DataType="positiveInteger")] + [System.Xml.Serialization.XmlAttributeAttribute(DataType="nonNegativeInteger")] public string scale; /// <remarks/> @@ -937,7 +937,7 @@ public string precision; /// <remarks/> - [System.Xml.Serialization.XmlAttributeAttribute(DataType="positiveInteger")] + [System.Xml.Serialization.XmlAttributeAttribute(DataType="nonNegativeInteger")] public string scale; /// <remarks/> @@ -1101,7 +1101,7 @@ public string precision; /// <remarks/> - [System.Xml.Serialization.XmlAttributeAttribute(DataType="positiveInteger")] + [System.Xml.Serialization.XmlAttributeAttribute(DataType="nonNegativeInteger")] public string scale; /// <remarks/> Modified: branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-09-23 10:10:00 UTC (rev 4722) +++ branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-09-24 11:20:25 UTC (rev 4723) @@ -233,7 +233,7 @@ </xs:attribute> <xs:attribute name="length" type="xs:positiveInteger" /> <xs:attribute name="precision" type="xs:positiveInteger" /> - <xs:attribute name="scale" type="xs:positiveInteger" /> + <xs:attribute name="scale" type="xs:nonNegativeInteger" /> <xs:attribute name="not-null" type="xs:boolean"> </xs:attribute> <xs:attribute name="unique" type="xs:boolean"> @@ -448,7 +448,7 @@ <xs:attribute name="type" type="xs:string" /> <xs:attribute name="length" type="xs:positiveInteger" /> <xs:attribute name="precision" type="xs:positiveInteger" /> - <xs:attribute name="scale" type="xs:positiveInteger" /> + <xs:attribute name="scale" type="xs:nonNegativeInteger" /> <xs:attribute name="not-null" default="false" type="xs:boolean"> </xs:attribute> <xs:attribute name="unique" default="false" type="xs:boolean"> @@ -1158,7 +1158,7 @@ <xs:attribute name="column" type="xs:string" /> <xs:attribute name="length" type="xs:positiveInteger" /> <xs:attribute name="precision" type="xs:positiveInteger" /> - <xs:attribute name="scale" type="xs:positiveInteger" /> + <xs:attribute name="scale" type="xs:nonNegativeInteger" /> <xs:attribute name="not-null" type="xs:boolean"> </xs:attribute> <xs:attribute name="unique" default="false" type="xs:boolean"> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Fixture.cs 2009-09-24 11:20:25 UTC (rev 4723) @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1948 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + [Test] + public void CanUseDecimalScaleZero() + { + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + Person person = + new Person() + { + Age = 50, + ShoeSize = 10, + FavouriteNumbers = + new List<decimal>() + { + 20, + 30, + 40, + }, + }; + + s.Save(person); + s.Flush(); + tx.Rollback(); + } + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Mappings.hbm.xml 2009-09-24 11:20:25 UTC (rev 4723) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1948"> + + <class name="Person"> + <id name="Id"> + <generator class="native" /> + </id> + + <property name="Age" type="decimal" precision="2" scale="0" /> + + <property name="ShoeSize"> + <column name="ShoeSizeColumn" precision="2" scale="0"/> + </property> + + <bag name="FavouriteNumbers" table="FavNum"> + <key column="Person" /> + <element type="decimal" precision="2" scale="0" /> + </bag> + + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1948/Model.cs 2009-09-24 11:20:25 UTC (rev 4723) @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1948 +{ + public class Person + { + public virtual int Id { get; set; } + public virtual decimal Age { get; set; } + public virtual decimal ShoeSize { get; set; } + public virtual IList<decimal> FavouriteNumbers { get; set; } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-23 10:10:00 UTC (rev 4722) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-24 11:20:25 UTC (rev 4723) @@ -578,6 +578,8 @@ <Compile Include="NHSpecificTest\NH1941\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1941\Model.cs" /> <Compile Include="NHSpecificTest\NH1941\SexEnumStringType.cs" /> + <Compile Include="NHSpecificTest\NH1948\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1948\Model.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> <Compile Include="NHSpecificTest\NH473\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Parent.cs" /> @@ -1989,6 +1991,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1948\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1941\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1922\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\CriteriaQueryOnComponentCollection\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-09-27 10:06:26
|
Revision: 4729 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4729&view=rev Author: ricbrown Date: 2009-09-27 10:06:11 +0000 (Sun, 27 Sep 2009) Log Message: ----------- Fix NH-1959, add/remove from IdBag causing KeyNotFoundException Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs 2009-09-26 12:07:41 UTC (rev 4728) +++ branches/2.1.x/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs 2009-09-27 10:06:11 UTC (rev 4729) @@ -290,6 +290,9 @@ protected void BeforeRemove(int index) { + if (!identifiers.ContainsKey(index)) + return; // index not previously persisted, nothing to do + // Move the identifier being removed to the end of the list (i.e. it isn't actually removed). object removedId = identifiers[index]; int last = values.Count - 1; Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Fixture.cs 2009-09-27 10:06:11 UTC (rev 4729) @@ -0,0 +1,74 @@ +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1959 +{ + [TestFixture] + public class Fixture : BugTestCase + { + + protected override void OnTearDown() + { + using (ISession s = OpenSession()) + using(ITransaction tx = s.BeginTransaction()) + { + s.Delete("from ClassB"); + s.Delete("from ClassA"); + tx.Commit(); + } + } + + [Test] + public void StartWithEmptyDoAddAndRemove() + { + ClassB b = new ClassB(); + ClassA a = new ClassA(); + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + s.Save(a); + s.Save(b); + tx.Commit(); + } + + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + ClassA loadedA = s.Get<ClassA>(a.Id); + ClassB loadedB = s.Get<ClassB>(b.Id); + loadedA.TheBag.Add(loadedB); + loadedA.TheBag.Remove(loadedB); + tx.Commit(); + } + + using (ISession s = OpenSession()) + Assert.AreEqual(0, s.Get<ClassA>(a.Id).TheBag.Count); + } + + [Test] + public void StartWithEmptyDoAddAndRemoveAt() + { + ClassB b = new ClassB(); + ClassA a = new ClassA(); + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + s.Save(a); + s.Save(b); + tx.Commit(); + } + + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + ClassA loadedA = s.Get<ClassA>(a.Id); + ClassB loadedB = s.Get<ClassB>(b.Id); + loadedA.TheBag.Add(loadedB); + loadedA.TheBag.RemoveAt(0); + tx.Commit(); + } + + using (ISession s = OpenSession()) + Assert.AreEqual(0, s.Get<ClassA>(a.Id).TheBag.Count); + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Mappings.hbm.xml 2009-09-27 10:06:11 UTC (rev 4729) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1959" + assembly="NHibernate.Test"> + + <class name="ClassA"> + <id name="Id"> + <generator class="guid.comb"/> + </id> + <idbag name="TheBag"> + <collection-id column="collection_id" type="guid"> + <generator class="guid.comb"/> + </collection-id> + <key> + <column name="classA" not-null="true" /> + </key> + <many-to-many class="ClassB"> + <column name="classB" not-null="true" /> + </many-to-many> + </idbag> + </class> + + <class name="ClassB"> + <id name="Id"> + <generator class="guid.comb"/> + </id> + </class> + +</hibernate-mapping> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1959/Model.cs 2009-09-27 10:06:11 UTC (rev 4729) @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1959 +{ + public class ClassA + { + public virtual Guid Id { get; set; } + public virtual IList<ClassB> TheBag { get; set; } + + public ClassA() + { + TheBag = new List<ClassB>(); + } + } + + public class ClassB + { + public virtual Guid Id { get; set; } + } +} Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-26 12:07:41 UTC (rev 4728) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-09-27 10:06:11 UTC (rev 4729) @@ -580,6 +580,8 @@ <Compile Include="NHSpecificTest\NH1941\SexEnumStringType.cs" /> <Compile Include="NHSpecificTest\NH1948\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1948\Model.cs" /> + <Compile Include="NHSpecificTest\NH1959\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1959\Model.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> <Compile Include="NHSpecificTest\NH473\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Parent.cs" /> @@ -1991,6 +1993,7 @@ <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1959\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1948\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1941\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1922\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-10-01 13:40:01
|
Revision: 4736 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4736&view=rev Author: ricbrown Date: 2009-10-01 12:29:05 +0000 (Thu, 01 Oct 2009) Log Message: ----------- Fix NH-1915, throw correct exception when joining on invalid path Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-10-01 10:02:34 UTC (rev 4735) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-10-01 12:29:05 UTC (rev 4736) @@ -679,6 +679,12 @@ dot.Resolve( true, false, alias == null ? null : alias.Text ); FromElement fromElement = dot.GetImpliedJoin(); + + if (fromElement == null) + { + throw new InvalidPathException("Invalid join: " + dot.Path); + } + fromElement.SetAllPropertyFetch(propertyFetch!=null); if ( with != null ) Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-10-01 10:02:34 UTC (rev 4735) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-10-01 12:29:05 UTC (rev 4736) @@ -1,6 +1,7 @@ using System; using System.Collections; using NHibernate.Engine.Query; +using NHibernate.Hql.Ast.ANTLR; using NHibernate.Util; using NUnit.Framework; @@ -131,5 +132,20 @@ s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = {0}", int.MaxValue + 1L)).List(); } } + + [Test] + public void InvalidJoinOnProperty() + { + // NH-1915 + using (ISession s = OpenSession()) + { + Assert.Throws<InvalidPathException>( + () => + { + s.CreateQuery("from Zoo z inner join fetch z.classification").List(); + }, + "Incorrect path not caught during parsing"); + } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-10-08 17:50:32
|
Revision: 4740 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4740&view=rev Author: ricbrown Date: 2009-10-08 17:50:20 +0000 (Thu, 08 Oct 2009) Log Message: ----------- Fix NH-1964, NH-1983, Blobs and Clobs with Sql Server CE Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Driver/SqlServerCeDriver.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeDriverFixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeEntity.hbm.xml Modified: branches/2.1.x/nhibernate/src/NHibernate/Driver/SqlServerCeDriver.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Driver/SqlServerCeDriver.cs 2009-10-01 12:44:34 UTC (rev 4739) +++ branches/2.1.x/nhibernate/src/NHibernate/Driver/SqlServerCeDriver.cs 2009-10-08 17:50:20 UTC (rev 4740) @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Data; +using System.Reflection; using NHibernate.Cfg; using NHibernate.SqlCommand; using NHibernate.SqlTypes; @@ -24,11 +25,18 @@ } private bool prepareSql; + private PropertyInfo dbParamSqlDbTypeProperty; public override void Configure(IDictionary<string, string> settings) { base.Configure(settings); prepareSql = PropertiesHelper.GetBoolean(Environment.PrepareSql, settings, false); + + using (IDbCommand cmd = CreateCommand()) + { + IDbDataParameter dbParam = cmd.CreateParameter(); + dbParamSqlDbTypeProperty = dbParam.GetType().GetProperty("SqlDbType"); + } } /// <summary> @@ -94,5 +102,24 @@ { get { return true; } } + + protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) + { + base.InitializeParameter(dbParam, name, sqlType); + + AdjustDbParamTypeForLargeObjects(dbParam, sqlType); + } + + private void AdjustDbParamTypeForLargeObjects(IDbDataParameter dbParam, SqlType sqlType) + { + if (sqlType is BinaryBlobSqlType) + { + dbParamSqlDbTypeProperty.SetValue(dbParam, SqlDbType.Image, null); + } + else if (sqlType is StringClobSqlType) + { + dbParamSqlDbTypeProperty.SetValue(dbParam, SqlDbType.NText, null); + } + } } } \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeDriverFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeDriverFixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeDriverFixture.cs 2009-10-08 17:50:20 UTC (rev 4740) @@ -0,0 +1,112 @@ +using System; +using System.Collections; +using NHibernate.Cfg; +using NHibernate.Dialect; +using NUnit.Framework; +using NHibernate.Criterion; +using System.Collections.Generic; + +namespace NHibernate.Test.DriverTest +{ + public class SqlServerCeEntity + { + public virtual int Id { get; set; } + + public virtual string StringProp { get; set; } + public virtual byte[] BinaryProp { get; set; } + + public virtual string StringClob { get; set; } + public virtual byte[] BinaryBlob { get; set; } + } + + [TestFixture] + public class SqlServerCeDriverFixture : TestCase + { + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } + + protected override IList Mappings + { + get { return new[] { "DriverTest.SqlServerCeEntity.hbm.xml" }; } + } + + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return dialect is MsSqlCeDialect; + } + + protected override void OnTearDown() + { + base.OnTearDown(); + + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + s.Delete("from SqlServerCeEntity"); + tx.Commit(); + } + } + + [Test] + public void SaveLoad() + { + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + SqlServerCeEntity entity = new SqlServerCeEntity(); + entity.StringProp = "a small string"; + entity.BinaryProp = new byte[100]; + + entity.StringClob = new String('a', 8193); + entity.BinaryBlob = new byte[8193]; + + s.Save(entity); + tx.Commit(); + } + + using (ISession s = OpenSession()) + { + SqlServerCeEntity entity = + s.CreateCriteria(typeof(SqlServerCeEntity)) + .UniqueResult<SqlServerCeEntity>(); + + Assert.That(entity.StringProp, Is.EqualTo("a small string")); + Assert.That(entity.BinaryProp.Length, Is.EqualTo(100)); + + Assert.That(entity.StringClob, Is.EqualTo(new String('a', 8193))); + Assert.That(entity.BinaryBlob.Length, Is.EqualTo(8193)); + } + } + + [Test] + public void Query() + { + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + SqlServerCeEntity entity = new SqlServerCeEntity(); + entity.StringProp = "a small string"; + entity.BinaryProp = System.Text.ASCIIEncoding.ASCII.GetBytes("binary string"); + + entity.StringClob = new String('a', 8193); + entity.BinaryBlob = new byte[8193]; + + s.Save(entity); + tx.Commit(); + } + + using (ISession s = OpenSession()) + { + IList<SqlServerCeEntity> entities = + s.CreateCriteria(typeof(SqlServerCeEntity)) + .Add(Restrictions.Eq("StringProp", "a small string")) + .Add(Restrictions.Eq("BinaryProp", System.Text.ASCIIEncoding.ASCII.GetBytes("binary string"))) + .List<SqlServerCeEntity>(); + + Assert.That(entities.Count, Is.EqualTo(1)); + } + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeEntity.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeEntity.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/DriverTest/SqlServerCeEntity.hbm.xml 2009-10-08 17:50:20 UTC (rev 4740) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.DriverTest" + assembly="NHibernate.Test"> + + <class name="SqlServerCeEntity"> + <id name="Id"> + <generator class="native" /> + </id> + + <property name="StringProp"/> <!-- maps to NVARCHAR(255) --> + <property name="BinaryProp"/> <!-- maps to VARBINARY(8000) --> + + <property name="StringClob" type="StringClob"> + <column name="StringClob" sql-type="ntext"/> + </property> + + <property name="BinaryBlob" type="BinaryBlob"> + <column name="BinaryBlob" sql-type="image"/> + </property> + + </class> +</hibernate-mapping> Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-01 12:44:34 UTC (rev 4739) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-08 17:50:20 UTC (rev 4740) @@ -105,6 +105,7 @@ <Compile Include="CfgTest\ConfigurationSchemaFixture.cs" /> <Compile Include="CfgTest\ConfigurationSerializationTests.cs" /> <Compile Include="CfgTest\DefaultNsAssmFixture.cs" /> + <Compile Include="DriverTest\SqlServerCeDriverFixture.cs" /> <Compile Include="FilterTest\ConfigFixture.cs" /> <Compile Include="FilterTest\FilterSecondPassArgsFixture.cs" /> <Compile Include="CfgTest\HbmBinderFixture.cs" /> @@ -1992,6 +1993,7 @@ <EmbeddedResource Include="Classic\EntityWithLifecycle.hbm.xml" /> <EmbeddedResource Include="Bytecode\Lightweight\ProductLine.hbm.xml" /> <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> + <EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> <EmbeddedResource Include="NHSpecificTest\NH1959\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1948\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-14 16:19:29
|
Revision: 4742 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4742&view=rev Author: fabiomaulo Date: 2009-10-14 16:19:19 +0000 (Wed, 14 Oct 2009) Log Message: ----------- Fix NH-1992 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/AdoNet/Util/BasicFormatter.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/BasicFormatterFixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/AdoNet/Util/BasicFormatter.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/AdoNet/Util/BasicFormatter.cs 2009-10-08 17:50:58 UTC (rev 4741) +++ branches/2.1.x/nhibernate/src/NHibernate/AdoNet/Util/BasicFormatter.cs 2009-10-14 16:19:19 UTC (rev 4742) @@ -79,6 +79,7 @@ private bool afterInsert; private bool afterOn; private bool beginLine = true; + private bool endCommandFound; private int indent = 1; private int inFunction; @@ -186,6 +187,7 @@ { Out(); indent = 1; + endCommandFound = true; Newline(); } @@ -285,6 +287,7 @@ { afterInsert = true; } + endCommandFound = false; } private void Select() @@ -296,6 +299,7 @@ afterByOrFromOrSelects.Insert(afterByOrFromOrSelects.Count, afterByOrSetOrFromOrSelect); parensSinceSelect = 0; afterByOrSetOrFromOrSelect = true; + endCommandFound = false; } private void Out() @@ -353,6 +357,11 @@ private void CloseParen() { + if (endCommandFound) + { + Out(); + return; + } parensSinceSelect--; if (parensSinceSelect < 0) { @@ -384,6 +393,11 @@ private void OpenParen() { + if(endCommandFound) + { + Out(); + return; + } if (IsFunctionName(lastToken) || inFunction > 0) { inFunction++; Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-08 17:50:58 UTC (rev 4741) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 16:19:19 UTC (rev 4742) @@ -1405,6 +1405,7 @@ <Compile Include="UserCollection\User.cs" /> <Compile Include="UserCollection\UserCollectionTypeTest.cs" /> <Compile Include="UtilityTest\AssemblyQualifiedTypeNameFixture.cs" /> + <Compile Include="UtilityTest\BasicFormatterFixture.cs" /> <Compile Include="UtilityTest\IdentityMapFixture.cs" /> <Compile Include="UtilityTest\IdentityMapSequencedFixture.cs" /> <Compile Include="UtilityTest\JoinedEnumerableFixture.cs" /> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/BasicFormatterFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/BasicFormatterFixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/BasicFormatterFixture.cs 2009-10-14 16:19:19 UTC (rev 4742) @@ -0,0 +1,23 @@ +using NHibernate.AdoNet.Util; +using NUnit.Framework; + +namespace NHibernate.Test.UtilityTest +{ + [TestFixture] + public class BasicFormatterFixture + { + [Test] + public void StringWithNestedDelimiters() + { + string formattedSql = null; + IFormatter formatter = new BasicFormatter(); + string sql = @"INSERT INTO Table (Name, id) VALUES (@p0, @p1); @p0 = 'a'(b', @p1 = 1"; + Assert.DoesNotThrow(() => formattedSql = formatter.Format(sql)); + Assert.That(formattedSql, Text.Contains("'a'(b'")); + + sql = @"UPDATE Table SET Column = @p0;@p0 = '(')'"; + Assert.DoesNotThrow(() => formattedSql = formatter.Format(sql)); + Assert.That(formattedSql, Text.Contains("'(')'")); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-14 17:27:05
|
Revision: 4743 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4743&view=rev Author: fabiomaulo Date: 2009-10-14 17:26:57 +0000 (Wed, 14 Oct 2009) Log Message: ----------- Fix NH-1990 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Model.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-10-14 16:19:19 UTC (rev 4742) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Collection/SubselectOneToManyLoader.cs 2009-10-14 17:26:57 UTC (rev 4743) @@ -3,6 +3,7 @@ using NHibernate.Persister.Collection; using NHibernate.SqlCommand; using NHibernate.Type; +using NHibernate.Util; namespace NHibernate.Loader.Collection { @@ -31,8 +32,8 @@ namedParameters = queryParameters.NamedParameters; // NH Different behavior: to deal with positionslParameter+NamedParameter+ParameterOfFilters - types = queryParameters.PositionalParameterTypes; - values = queryParameters.PositionalParameterValues; + types = new List<IType>(new JoinedEnumerable<IType>(queryParameters.FilteredParameterTypes, queryParameters.PositionalParameterTypes)).ToArray(); + values = new List<object>(new JoinedEnumerable<object>(queryParameters.FilteredParameterValues, queryParameters.PositionalParameterValues)).ToArray(); this.namedParameterLocMap = namedParameterLocMap; } Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Fixture.cs 2009-10-14 17:26:57 UTC (rev 4743) @@ -0,0 +1,134 @@ +using System.Collections.Generic; +using System.Text; +using NHibernate.Criterion; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1990 +{ + [TestFixture] + public class Fixture : BugTestCase + { + protected override void OnSetUp() + { + using (ISession s = OpenSession()) + { + using (ITransaction tx = s.BeginTransaction()) + { + for (int i = 0; i < 10; i++) + { + var feed = new NewsFeed + { + Url = string.Format("Feed{0}Uri", i), + Title = string.Format("Feed{0}", i), + Status = (i % 2 == 0 ? 1 : 2) + }; + s.Save(feed); + + for (int j = 0; j < 8; j++) + { + var item = new NewsItem + {Title = string.Format("Feed{0}Item{1}", i, j), Status = (j % 2 == 0 ? 1 : 2), Feed = feed}; + s.Save(item); + } + } + tx.Commit(); + } + } + } + + protected override void OnTearDown() + { + using (ISession s = OpenSession()) + { + using (ITransaction tx = s.BeginTransaction()) + { + s.Delete(string.Format("from {0}", typeof (NewsItem).Name)); + s.Delete(string.Format("from {0}", typeof (NewsFeed).Name)); + tx.Commit(); + } + } + } + + [Test] + public void FetchingBySubqueryFilterParameters() + { + using (ISession s = OpenSession()) + { + using (ITransaction tx = s.BeginTransaction()) + { + IFilter filter = s.EnableFilter("StatusFilter"); + filter.SetParameter("Status", 1); + + ICriteria criteria = s.CreateCriteria(typeof (NewsFeed), "NewsFeed"); + IList<NewsFeed> feeds = criteria.List<NewsFeed>(); + + Assert.That(feeds.Count, Is.EqualTo(5)); + foreach (NewsFeed feed in feeds) + { + Assert.That(feed.Items.Count, Is.EqualTo(4)); + } + + tx.Commit(); + } + } + } + + [Test] + public void FetchingBySubqueryFilterParametersAndPositionalParameters() + { + using (ISession s = OpenSession()) + { + using (ITransaction tx = s.BeginTransaction()) + { + IFilter filter = s.EnableFilter("StatusFilter"); + filter.SetParameter("Status", 1); + + ICriteria criteria = s.CreateCriteria(typeof (NewsFeed), "NewsFeed"); + criteria.Add(Restrictions.In("Url", new[] {"Feed2Uri", "Feed4Uri", "Feed8Uri"})); + + IList<NewsFeed> feeds = criteria.List<NewsFeed>(); + + Assert.That(feeds.Count, Is.EqualTo(3)); + foreach (NewsFeed feed in feeds) + { + Assert.That(feed.Items.Count, Is.EqualTo(4)); + } + + tx.Commit(); + } + } + } + + [Test] + public void FetchingBySubqueryFilterParametersAndPositionalParametersAndNamedParameters() + { + using (ISession s = OpenSession()) + { + using (ITransaction tx = s.BeginTransaction()) + { + IFilter filter = s.EnableFilter("StatusFilter"); + filter.SetParameter("Status", 1); + + var hql = new StringBuilder(); + hql.AppendLine("from NewsFeed"); + hql.AppendLine("where (Url = ? or Url = ?) and Title in (:TitleList)) "); + + IQuery query = s.CreateQuery(hql.ToString()); + query.SetString(0, "Feed4Uri"); + query.SetString(1, "Feed8Uri"); + query.SetParameterList("TitleList", new[] {"Feed2", "Feed4", "Feed8"}); + + IList<NewsFeed> feeds = query.List<NewsFeed>(); + + Assert.That(feeds.Count, Is.EqualTo(2)); + foreach (NewsFeed feed in feeds) + { + Assert.That(feed.Items.Count, Is.EqualTo(4)); + } + + tx.Commit(); + } + } + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Mappings.hbm.xml 2009-10-14 17:26:57 UTC (rev 4743) @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1990" + assembly="NHibernate.Test"> + + <class name="NewsFeed" table="NWS_Feed" batch-size="100"> + <id name="Id" type="Guid" column="OID"> + <generator class="guid"></generator> + </id> + <property name="Title" type="String" not-null="true"/> + <property name="Url" type="String" not-null="true"/> + <property name="Status" type="Int32" not-null="true"/> + <bag name="Items" cascade="all" fetch="subselect" inverse="true" > + <key column="FK_Feed_OID"/> + <one-to-many class="NewsItem"></one-to-many> + <filter name="StatusFilter" condition=":Status=Status" /> + </bag> + <filter name="StatusFilter" condition=":Status=Status" /> + </class> + + <class name="NewsItem" table="NWS_Item" batch-size="100"> + <id name="Id" type="Guid" column="OID"> + <generator class="guid"></generator> + </id> + <property name="Title" type="String" not-null="true"/> + <property name="Status" type="Int32" not-null="true"/> + <many-to-one name="Feed" class="NewsFeed" column="FK_Feed_OID" not-null="true"/> + + <filter name="StatusFilter" condition=":Status=Status" /> + </class> + + <filter-def name="StatusFilter"> + <filter-param name="Status" type="Int32"/> + </filter-def> +</hibernate-mapping> + + Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Model.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Model.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1990/Model.cs 2009-10-14 17:26:57 UTC (rev 4743) @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1990 +{ + public class NewsFeed + { + public NewsFeed() + { + Items = new List<NewsItem>(); + } + + public virtual Guid Id { get; set; } + public virtual string Title { get; set; } + public virtual string Url { get; set; } + public virtual int Status { get; set; } + public virtual IList<NewsItem> Items { get; set; } + } + + public class NewsItem + { + public virtual Guid Id { get; set; } + public virtual string Title { get; set; } + public virtual int Status { get; set; } + public virtual NewsFeed Feed { get; set; } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 16:19:19 UTC (rev 4742) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 17:26:57 UTC (rev 4743) @@ -583,6 +583,8 @@ <Compile Include="NHSpecificTest\NH1948\Model.cs" /> <Compile Include="NHSpecificTest\NH1959\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1959\Model.cs" /> + <Compile Include="NHSpecificTest\NH1990\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1990\Model.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> <Compile Include="NHSpecificTest\NH473\Fixture.cs" /> <Compile Include="NHSpecificTest\NH473\Parent.cs" /> @@ -1996,6 +1998,7 @@ <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1990\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1959\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1948\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1941\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-14 19:45:27
|
Revision: 4745 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4745&view=rev Author: fabiomaulo Date: 2009-10-14 19:45:17 +0000 (Wed, 14 Oct 2009) Log Message: ----------- Fix NH-1985 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/DomainClass.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs 2009-10-14 19:09:18 UTC (rev 4744) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs 2009-10-14 19:45:17 UTC (rev 4745) @@ -90,12 +90,11 @@ version = entityEntry.Version; } - /*if ( !persister.isMutable() ) { - throw new HibernateException( - "attempted to delete an object of immutable class: " + - MessageHelper.infoString(persister) - ); - }*/ + if (!persister.IsMutable) + { + throw new HibernateException("Attempted to delete an object of immutable class: " + + MessageHelper.InfoString(persister)); + } if (InvokeDeleteLifecycle(source, entity, persister)) { Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/DomainClass.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/DomainClass.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/DomainClass.cs 2009-10-14 19:45:17 UTC (rev 4745) @@ -0,0 +1,9 @@ +namespace NHibernate.Test.NHSpecificTest.NH1985 +{ + public class DomainClass + { + public int Id { get; set; } + + public string Label { get; set; } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/Mappings.hbm.xml 2009-10-14 19:45:17 UTC (rev 4745) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1985" + default-lazy="false"> + <class name="DomainClass" mutable="false"> + <id name="Id"> + <generator class="assigned" /> + </id> + <property name="Label" /> + </class> +</hibernate-mapping> \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs 2009-10-14 19:45:17 UTC (rev 4745) @@ -0,0 +1,66 @@ +using System; +using System.Data; +using NHibernate.Connection; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1985 +{ + [TestFixture] + public class SampleTest : BugTestCase + { + protected override void OnSetUp() + { + base.OnSetUp(); + + if (0 == ExecuteStatement("INSERT INTO DomainClass (Id, Label) VALUES (1, 'TEST record');")) + { + throw new ApplicationException("Insertion of test record failed."); + } + } + + protected override void OnTearDown() + { + base.OnTearDown(); + + ExecuteStatement("DELETE FROM DomainClass WHERE Id=1;"); + } + + [Test] + public void AttemptToDeleteImmutableObjectShouldThrow() + { + using (ISession session = OpenSession()) + { + Assert.Throws<HibernateException>(() => + { + using (ITransaction trans = session.BeginTransaction()) + { + var entity = session.Get<DomainClass>(1); + session.Delete(entity); + + trans.Commit(); // This used to throw... + } + }); + } + + using (IConnectionProvider prov = ConnectionProviderFactory.NewConnectionProvider(cfg.Properties)) + { + IDbConnection conn = prov.GetConnection(); + + try + { + using (IDbCommand comm = conn.CreateCommand()) + { + comm.CommandText = "SELECT Id FROM DomainClass WHERE Id=1 AND Label='TEST record'"; + object result = comm.ExecuteScalar(); + + Assert.That(result != null, "Immutable object has been deleted!"); + } + } + finally + { + prov.CloseConnection(conn); + } + } + } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 19:09:18 UTC (rev 4744) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 19:45:17 UTC (rev 4745) @@ -583,6 +583,8 @@ <Compile Include="NHSpecificTest\NH1948\Model.cs" /> <Compile Include="NHSpecificTest\NH1959\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1959\Model.cs" /> + <Compile Include="NHSpecificTest\NH1985\DomainClass.cs" /> + <Compile Include="NHSpecificTest\NH1985\SampleTest.cs" /> <Compile Include="NHSpecificTest\NH1990\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1990\Model.cs" /> <Compile Include="NHSpecificTest\NH473\Child.cs" /> @@ -1998,6 +2000,7 @@ <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1985\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1990\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1959\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1948\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-14 20:25:49
|
Revision: 4747 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4747&view=rev Author: fabiomaulo Date: 2009-10-14 20:25:37 +0000 (Wed, 14 Oct 2009) Log Message: ----------- Fix NH-1973 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Type/DateTime2Type.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/Dates/DateTime2Fixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Type/DateTime2Type.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Type/DateTime2Type.cs 2009-10-14 20:22:58 UTC (rev 4746) +++ branches/2.1.x/nhibernate/src/NHibernate/Type/DateTime2Type.cs 2009-10-14 20:25:37 UTC (rev 4747) @@ -19,5 +19,37 @@ { get { return "DateTime2"; } } + + public override object Get(IDataReader rs, int index) + { + try + { + return Convert.ToDateTime(rs[index]); + } + catch (Exception ex) + { + throw new FormatException(string.Format("Input value '{0}' was not in the correct format.", rs[index]), ex); + } + } + + public override void Set(IDbCommand st, object value, int index) + { + ((IDataParameter) st.Parameters[index]).Value = (DateTime) value; + } + + public override bool IsEqual(object x, object y) + { + if (x == y) + { + return true; + } + + if (x == null || y == null) + { + return false; + } + + return x.Equals(y); + } } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/Dates/DateTime2Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/Dates/DateTime2Fixture.cs 2009-10-14 20:22:58 UTC (rev 4746) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/Dates/DateTime2Fixture.cs 2009-10-14 20:25:37 UTC (rev 4747) @@ -33,5 +33,14 @@ SavingAndRetrievingAction(new AllDates { Sql_datetime2 = DateTime.MaxValue }, entity => DateTimeAssert.AreEqual(entity.Sql_datetime2, DateTime.MaxValue)); } + + [Test] + public void SaveMillisecond() + { + DateTime datetime2 = DateTime.MinValue.AddMilliseconds(123); + + SavingAndRetrievingAction(new AllDates { Sql_datetime2 = datetime2 }, + entity => Assert.That(entity.Sql_datetime2, Is.EqualTo(datetime2))); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-14 22:03:08
|
Revision: 4752 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4752&view=rev Author: fabiomaulo Date: 2009-10-14 22:02:56 +0000 (Wed, 14 Oct 2009) Log Message: ----------- Fix NH-1931 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryNonScalarReturn.cs branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryScalarReturn.cs branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQuerySpecification.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryNonScalarReturnTest.cs branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryScalarReturnTest.cs branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQuerySpecificationTest.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryNonScalarReturn.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryNonScalarReturn.cs 2009-10-14 20:50:22 UTC (rev 4751) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryNonScalarReturn.cs 2009-10-14 22:02:56 UTC (rev 4752) @@ -1,5 +1,4 @@ using System; -using System.Collections; using NHibernate.Util; using System.Collections.Generic; @@ -51,5 +50,28 @@ { get { return propertyResults; } } + + public override bool Equals(object obj) + { + return Equals(obj as NativeSQLQueryNonScalarReturn); + } + + public bool Equals(NativeSQLQueryNonScalarReturn other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return Equals(other.alias, alias); + } + + public override int GetHashCode() + { + return alias.GetHashCode(); + } } } Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryScalarReturn.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryScalarReturn.cs 2009-10-14 20:50:22 UTC (rev 4751) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQueryScalarReturn.cs 2009-10-14 22:02:56 UTC (rev 4752) @@ -28,5 +28,28 @@ { get { return type; } } + + public override bool Equals(object obj) + { + return Equals(obj as NativeSQLQueryScalarReturn); + } + + public bool Equals(NativeSQLQueryScalarReturn other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return Equals(other.columnAlias, columnAlias); + } + + public override int GetHashCode() + { + return columnAlias.GetHashCode(); + } } } Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQuerySpecification.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQuerySpecification.cs 2009-10-14 20:50:22 UTC (rev 4751) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/Query/Sql/NativeSQLQuerySpecification.cs 2009-10-14 22:02:56 UTC (rev 4752) @@ -38,7 +38,7 @@ hCode = 29 * hCode + CollectionHelper.GetHashCode(this.querySpaces); if (this.sqlQueryReturns != null) { - hCode = 29 * hCode + sqlQueryReturns.Length; + hCode = 29 * hCode + CollectionHelper.GetHashCode(this.sqlQueryReturns); } } @@ -65,16 +65,13 @@ if (this == obj) return true; - NativeSQLQuerySpecification that = obj as NativeSQLQuerySpecification; + var that = obj as NativeSQLQuerySpecification; if (that == null) return false; - return hashCode == that.hashCode && - CollectionHelper.CollectionEquals(querySpaces, that.querySpaces) && - querySpaces.Equals(that.querySpaces) && - queryString.Equals(that.queryString) && - CollectionHelper.CollectionEquals<INativeSQLQueryReturn>(sqlQueryReturns, that.sqlQueryReturns); + // NHibernate different impl.: NativeSQLQuerySpecification is immutable and the hash is calculated at Ctor + return hashCode == that.hashCode; } public override int GetHashCode() Added: branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryNonScalarReturnTest.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryNonScalarReturnTest.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryNonScalarReturnTest.cs 2009-10-14 22:02:56 UTC (rev 4752) @@ -0,0 +1,57 @@ +using NHibernate.Engine.Query.Sql; +using NUnit.Framework; + +namespace NHibernate.Test.EngineTest +{ + [TestFixture] + public class NativeSQLQueryNonScalarReturnTest + { + [Test] + public void NativeSQLQueryCollectionReturnEqualsByAlias() + { + var sr1 = new NativeSQLQueryCollectionReturn("myAlias", "owner", "ownerProp", null,LockMode.None); + var sr2 = new NativeSQLQueryCollectionReturn("myAlias", "owner", "ownerProp", null, LockMode.None); + Assert.AreEqual(sr1, sr2); + } + + [Test] + public void NativeSQLQueryCollectionReturnHashCodeByAlias() + { + var sr1 = new NativeSQLQueryCollectionReturn("myAlias", "owner", "ownerProp", null,LockMode.None); + var sr2 = new NativeSQLQueryCollectionReturn("myAlias", "owner", "ownerProp", null, LockMode.None); + Assert.AreEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + + [Test] + public void NativeSQLQueryJoinReturnEqualsByAlias() + { + var sr1 = new NativeSQLQueryJoinReturn("myAlias", "owner", "ownerProp", null, LockMode.None); + var sr2 = new NativeSQLQueryJoinReturn("myAlias", "owner", "ownerProp", null, LockMode.None); + Assert.AreEqual(sr1, sr2); + } + + [Test] + public void NativeSQLQueryJoinReturnHashCodeByAlias() + { + var sr1 = new NativeSQLQueryJoinReturn("myAlias", "owner", "ownerProp", null, LockMode.None); + var sr2 = new NativeSQLQueryJoinReturn("myAlias", "owner", "ownerProp", null, LockMode.None); + Assert.AreEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + + [Test] + public void NativeSQLQueryRootReturnEqualsByAlias() + { + var sr1 = new NativeSQLQueryRootReturn("myAlias", "entity", null, LockMode.None); + var sr2 = new NativeSQLQueryRootReturn("myAlias", "entity", null, LockMode.None); + Assert.AreEqual(sr1, sr2); + } + + [Test] + public void NativeSQLQueryRootReturnHashCodeByAlias() + { + var sr1 = new NativeSQLQueryRootReturn("myAlias", "entity", null, LockMode.None); + var sr2 = new NativeSQLQueryRootReturn("myAlias", "entity", null, LockMode.None); + Assert.AreEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryScalarReturnTest.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryScalarReturnTest.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQueryScalarReturnTest.cs 2009-10-14 22:02:56 UTC (rev 4752) @@ -0,0 +1,25 @@ +using NHibernate.Engine.Query.Sql; +using NUnit.Framework; + +namespace NHibernate.Test.EngineTest +{ + [TestFixture] + public class NativeSQLQueryScalarReturnTest + { + [Test] + public void EqualsByAlias() + { + var sr1 = new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32); + var sr2 = new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32); + Assert.AreEqual(sr1, sr2); + } + + [Test] + public void HashCodeByAlias() + { + var sr1 = new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32); + var sr2 = new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32); + Assert.AreEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQuerySpecificationTest.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQuerySpecificationTest.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/NativeSQLQuerySpecificationTest.cs 2009-10-14 22:02:56 UTC (rev 4752) @@ -0,0 +1,59 @@ +using NHibernate.Engine.Query.Sql; +using NUnit.Framework; +using System.Collections.Generic; + +namespace NHibernate.Test.EngineTest +{ + [TestFixture] + public class NativeSQLQuerySpecificationTest + { + [Test] + public void Equality() + { + var sr1 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + var sr2 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + Assert.AreEqual(sr1, sr2); + } + + [Test] + public void HashCode() + { + var sr1 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + var sr2 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + Assert.AreEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + + [Test] + public void WhenChangeReturns_NotEqual() + { + var sr1 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + var sr2 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAliasChanged", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + Assert.AreNotEqual(sr1, sr2); + } + + [Test] + public void WhenChangeReturns_NotEqualHashCode() + { + var sr1 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + var sr2 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAliasChanged", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + Assert.AreNotEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + + [Test] + public void WhenChangeSpace_NotEqual() + { + var sr1 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + var sr2 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "ANOTHER" }); + Assert.AreNotEqual(sr1, sr2); + } + + [Test] + public void WhenChangeSpace_NotEqualHashCode() + { + var sr1 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "SOMETHING" }); + var sr2 = new NativeSQLQuerySpecification("SELECT * FROM SOMETHING", new INativeSQLQueryReturn[] { new NativeSQLQueryScalarReturn("myAlias", NHibernateUtil.Int32), new NativeSQLQueryScalarReturn("otherAlias", NHibernateUtil.Int32) }, new List<string> { "ANOTHER" }); + Assert.AreNotEqual(sr1.GetHashCode(), sr2.GetHashCode()); + } + + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 20:50:22 UTC (rev 4751) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 22:02:56 UTC (rev 4752) @@ -106,6 +106,9 @@ <Compile Include="CfgTest\ConfigurationSerializationTests.cs" /> <Compile Include="CfgTest\DefaultNsAssmFixture.cs" /> <Compile Include="DriverTest\SqlServerCeDriverFixture.cs" /> + <Compile Include="EngineTest\NativeSQLQueryNonScalarReturnTest.cs" /> + <Compile Include="EngineTest\NativeSQLQueryScalarReturnTest.cs" /> + <Compile Include="EngineTest\NativeSQLQuerySpecificationTest.cs" /> <Compile Include="FilterTest\ConfigFixture.cs" /> <Compile Include="FilterTest\FilterSecondPassArgsFixture.cs" /> <Compile Include="CfgTest\HbmBinderFixture.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-15 12:44:11
|
Revision: 4754 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4754&view=rev Author: fabiomaulo Date: 2009-10-15 12:43:59 +0000 (Thu, 15 Oct 2009) Log Message: ----------- Fix NH-1895 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/DomainClasses.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/SampleTest.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs 2009-10-14 22:03:56 UTC (rev 4753) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs 2009-10-15 12:43:59 UTC (rev 4754) @@ -140,12 +140,16 @@ protected virtual void DeleteTransientEntity(IEventSource session, object entity, bool cascadeDeleteEnabled, IEntityPersister persister, ISet transientEntities) { log.Info("handling transient entity in delete processing"); - if (transientEntities.Contains(entity)) + // NH different impl : NH-1895 + if(transientEntities == null) { + transientEntities = new HashedSet(); + } + if (!transientEntities.Add(entity)) + { log.Debug("already handled transient entity; skipping"); return; } - transientEntities.Add(entity); CascadeBeforeDelete(session, persister, entity, null, transientEntities); CascadeAfterDelete(session, persister, entity, transientEntities); } Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/DomainClasses.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/DomainClasses.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/DomainClasses.cs 2009-10-15 12:43:59 UTC (rev 4754) @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1895 +{ + public class Order + { + public Order() + { + Details = new List<Detail>(); + } + + public Guid Id { get; set; } + public string Name { get; set; } + public IList<Detail> Details { get; set; } + } + + public class Detail + { + public Guid Id { get; set; } + public string Name { get; set; } + public Order Parent { get; set; } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/Mappings.hbm.xml 2009-10-15 12:43:59 UTC (rev 4754) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1895" + default-lazy="false"> + <class name="Order" table="[Order]"> + <id name="Id" type="guid" column="O_Id"> + <generator class="assigned" /> + </id> + <property name="Name" type="string" column="O_Name" /> + <bag name="Details" inverse="true" cascade="delete-orphan" lazy="false" > + <key column="D_OrderId" /> + <one-to-many class="Detail" /> + </bag> + </class> + <class name="Detail" table="Detail"> + <id name="Id" type="guid" column="D_Id"> + <generator class="assigned" /> + </id> + <property name="Name" type="string" column="D_Name" /> + <many-to-one name="Parent" column="D_OrderId" not-null="true" class="Order" /> + </class> +</hibernate-mapping> \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/SampleTest.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/SampleTest.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1895/SampleTest.cs 2009-10-15 12:43:59 UTC (rev 4754) @@ -0,0 +1,30 @@ +using System; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1895 +{ + [TestFixture] + public class SampleTest : BugTestCase + { + [Test] + public void SaveTest() + { + var o = new Order {Id = Guid.NewGuid(), Name = "Test Order"}; + for (int i = 0; i < 5; i++) + { + var d = new Detail {Id = Guid.NewGuid(), Name = "Test Detail " + i, Parent = o}; + o.Details.Add(d); + } + using (ISession session = OpenSession()) + { + session.Save(o); + session.Flush(); + } + using (ISession session = OpenSession()) + { + session.Delete(o); + session.Flush(); + } + } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-14 22:03:56 UTC (rev 4753) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-15 12:43:59 UTC (rev 4754) @@ -368,6 +368,8 @@ <Compile Include="NHSpecificTest\ElementsEnums\Something.cs" /> <Compile Include="NHSpecificTest\NH1025\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1025\Model.cs" /> + <Compile Include="NHSpecificTest\NH1895\DomainClasses.cs" /> + <Compile Include="NHSpecificTest\NH1895\SampleTest.cs" /> <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1905\Model.cs" /> <Compile Include="NHSpecificTest\NH1908ThreadSafety\Fixture.cs" /> @@ -2005,6 +2007,7 @@ <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1895\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1025\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1985\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1990\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-15 15:56:50
|
Revision: 4757 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4757&view=rev Author: fabiomaulo Date: 2009-10-15 15:56:44 +0000 (Thu, 15 Oct 2009) Log Message: ----------- BackPort from r4756 (fix NH-1963) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Engine/TypedValue.cs branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/TypedValue.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/TypedValue.cs 2009-10-15 15:55:27 UTC (rev 4756) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/TypedValue.cs 2009-10-15 15:56:44 UTC (rev 4757) @@ -22,7 +22,7 @@ this.type = type; this.value = value; ICollection values = value as ICollection; - if (!type.IsCollectionType && values != null) + if (!type.IsCollectionType && values != null && !type.ReturnedClass.IsArray) comparer = new ParameterListComparer(entityMode); else comparer = new DefaultComparer(entityMode); @@ -38,6 +38,11 @@ get { return type; } } + public IEqualityComparer<TypedValue> Comparer + { + get { return comparer; } + } + public override int GetHashCode() { return comparer.GetHashCode(this); @@ -54,7 +59,7 @@ } [Serializable] - private class ParameterListComparer : IEqualityComparer<TypedValue> + public class ParameterListComparer : IEqualityComparer<TypedValue> { private readonly EntityMode entityMode; @@ -118,7 +123,7 @@ } [Serializable] - private class DefaultComparer : IEqualityComparer<TypedValue> + public class DefaultComparer : IEqualityComparer<TypedValue> { private readonly EntityMode entityMode; Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs 2009-10-15 15:55:27 UTC (rev 4756) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs 2009-10-15 15:56:44 UTC (rev 4757) @@ -27,5 +27,16 @@ { Assert.AreEqual("null", new TypedValue(NHibernateUtil.Int32, null, EntityMode.Poco).ToString()); } + + [Test] + public void WhenTheTypeIsAnArray_ChoseTheDefaultComparer() + { + byte[] value = new byte[]{1,2,3}; + + + var tv = new TypedValue(NHibernateUtil.BinaryBlob, value, EntityMode.Poco); + + Assert.That(tv.Comparer, Is.TypeOf<TypedValue.DefaultComparer>()); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-15 18:19:55
|
Revision: 4758 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4758&view=rev Author: fabiomaulo Date: 2009-10-15 18:19:47 +0000 (Thu, 15 Oct 2009) Log Message: ----------- Fix NH-1979 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs 2009-10-15 15:56:44 UTC (rev 4757) +++ branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs 2009-10-15 18:19:47 UTC (rev 4758) @@ -397,7 +397,14 @@ public void Parameter() { - args.Add(new SqlString(SqlCommand.Parameter.Placeholder)); + if (argInd == args.Count) + { + args.Add(new SqlString(SqlCommand.Parameter.Placeholder)); + } + else + { + args[argInd] = args[argInd].Append(new SqlString(SqlCommand.Parameter.Placeholder)); + } } public void CommaBetweenParameters(string comma) Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-10-15 15:56:44 UTC (rev 4757) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-10-15 18:19:47 UTC (rev 4758) @@ -736,6 +736,23 @@ } } + [Test] + public void CastNH1979() + { + IgnoreIfNotSupported("cast"); + using (ISession s = OpenSession()) + { + Animal a1 = new Animal("abcdef", 1.3f); + s.Save(a1); + s.Flush(); + } + using (ISession s = OpenSession()) + { + string hql = "select cast(((a.BodyWeight + 50) / :divisor) as int) from Animal a"; + IList l = s.CreateQuery(hql).SetInt32("divisor", 2).List(); + Assert.AreEqual(1, l.Count); + } + } [Test] public void Current_TimeStamp() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-15 23:52:46
|
Revision: 4760 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4760&view=rev Author: fabiomaulo Date: 2009-10-15 23:52:32 +0000 (Thu, 15 Oct 2009) Log Message: ----------- Fix NH-1987 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiCriteriaImpl.cs branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs branches/2.1.x/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiCriteriaImpl.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiCriteriaImpl.cs 2009-10-15 18:21:31 UTC (rev 4759) +++ branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiCriteriaImpl.cs 2009-10-15 23:52:32 UTC (rev 4760) @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Diagnostics; using Iesi.Collections; using Iesi.Collections.Generic; using log4net; @@ -189,6 +190,14 @@ private void GetResultsFromDatabase(IList results) { + bool statsEnabled = session.Factory.Statistics.IsStatisticsEnabled; + var stopWatch = new Stopwatch(); + if (statsEnabled) + { + stopWatch.Start(); + } + int rowCount = 0; + using ( IDbCommand command = session.Batcher.PrepareCommand(CommandType.Text, sqlString, types.ToArray())) @@ -228,6 +237,8 @@ int count; for (count = 0; count < maxRows && reader.Read(); count++) { + rowCount++; + object o = loader.GetRowFromResultSet(reader, session, queryParameters, loader.GetLockModes(queryParameters.LockModes), null, hydratedObjects[i], keys, false); @@ -262,6 +273,11 @@ } } } + if (statsEnabled) + { + stopWatch.Stop(); + session.Factory.StatisticsImplementor.QueryExecuted(string.Format("{0} queries (MultiCriteria)", loaders.Count), rowCount, stopWatch.Elapsed); + } } private void CreateCriteriaLoaders() Modified: branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs 2009-10-15 18:21:31 UTC (rev 4759) +++ branches/2.1.x/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs 2009-10-15 23:52:32 UTC (rev 4760) @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Data; +using System.Diagnostics; using System.Text.RegularExpressions; using Iesi.Collections; using log4net; @@ -474,6 +475,14 @@ protected ArrayList DoList() { + bool statsEnabled = session.Factory.Statistics.IsStatisticsEnabled; + var stopWatch = new Stopwatch(); + if (statsEnabled) + { + stopWatch.Start(); + } + int rowCount = 0; + IDbCommand command = PrepareQueriesCommand(); BindParameters(command); @@ -535,6 +544,8 @@ log.Debug("result set row: " + count); } + rowCount++; + object result = translator.Loader.GetRowFromResultSet(reader, session, @@ -590,6 +601,11 @@ translator.Loader.CreateSubselects(subselectResultKeys[i], parameter, session); } } + if (statsEnabled) + { + stopWatch.Stop(); + session.Factory.StatisticsImplementor.QueryExecuted(string.Format("{0} queries (MultiQuery)", translators.Count), rowCount, stopWatch.Elapsed); + } return results; } Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs 2009-10-15 18:21:31 UTC (rev 4759) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs 2009-10-15 23:52:32 UTC (rev 4760) @@ -1,5 +1,6 @@ using System.Collections; using Iesi.Collections.Generic; +using NHibernate.Criterion; using NHibernate.Stat; using NUnit.Framework; @@ -209,5 +210,53 @@ tx.Commit(); s.Close(); } + + [Test] + public void IncrementQueryExecutionCount_WhenExplicitQueryIsExecuted() + { + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + FillDb(s); + tx.Commit(); + } + + IStatistics stats = sessions.Statistics; + stats.Clear(); + using (ISession s = OpenSession()) + { + var r = s.CreateCriteria<Country>().List(); + } + Assert.AreEqual(1, stats.QueryExecutionCount); + + stats.Clear(); + using (ISession s = OpenSession()) + { + var r = s.CreateQuery("from Country").List(); + } + Assert.AreEqual(1, stats.QueryExecutionCount); + + stats.Clear(); + using (ISession s = OpenSession()) + { + var r = s.CreateMultiQuery().Add("from Country").Add("from Continent").List(); + } + Assert.AreEqual(1, stats.QueryExecutionCount); + + stats.Clear(); + using (ISession s = OpenSession()) + { + var r = s.CreateMultiCriteria().Add(DetachedCriteria.For<Country>()).Add(DetachedCriteria.For<Continent>()).List(); + } + Assert.AreEqual(1, stats.QueryExecutionCount); + + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + CleanDb(s); + tx.Commit(); + } + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-16 20:19:05
|
Revision: 4766 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4766&view=rev Author: fabiomaulo Date: 2009-10-16 20:18:56 +0000 (Fri, 16 Oct 2009) Log Message: ----------- Fix NH-1255 (re-fix after reopen) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Domain.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Fixture.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Mappings.hbm.xml Modified: branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-10-16 19:05:59 UTC (rev 4765) +++ branches/2.1.x/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2009-10-16 20:18:56 UTC (rev 4766) @@ -743,6 +743,7 @@ <xs:attribute name="foreign-key" type="xs:string" /> <xs:attribute name="lazy" type="restrictedLaziness"> </xs:attribute> + <xs:attribute name="not-found" default="exception" type="notFoundMode"/> </xs:complexType> </xs:element> <xs:element name="key-property"> Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Domain.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Domain.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Domain.cs 2009-10-16 20:18:56 UTC (rev 4766) @@ -0,0 +1,65 @@ +using System; + +namespace NHibernate.Test.NHSpecificTest.NH1255 +{ + public class Customer + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class CustomerValue + { + public CustomerValueId Id { get; set; } + public decimal Value { get; set; } + } + + public class CustomerValueId : IEquatable<CustomerValueId> + { + private int? requestedHashCode; + public Customer Customer { get; set; } + public int CustomKey { get; set; } + + public bool Equals(CustomerValueId other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return Equals(other.Customer, Customer) && other.CustomKey == CustomKey; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + if (ReferenceEquals(this, obj)) + { + return true; + } + if (obj.GetType() != typeof (CustomerValueId)) + { + return false; + } + return Equals((CustomerValueId) obj); + } + + public override int GetHashCode() + { + if (!requestedHashCode.HasValue) + { + unchecked + { + requestedHashCode = ((Customer != null ? Customer.GetHashCode() : base.GetHashCode()) * 397) ^ CustomKey; + } + } + return requestedHashCode.Value; + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Fixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Fixture.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Fixture.cs 2009-10-16 20:18:56 UTC (rev 4766) @@ -0,0 +1,19 @@ +using NHibernate.Cfg; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1255 +{ + [TestFixture] + public class Fixture + { + [Test] + public void CanLoadMappingWithNotNullIgnore() + { + var cfg = new Configuration(); + if (TestConfigurationHelper.hibernateConfigFile != null) + cfg.Configure(TestConfigurationHelper.hibernateConfigFile); + Assert.DoesNotThrow( + () => cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1255.Mappings.hbm.xml", typeof (Customer).Assembly)); + } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Mappings.hbm.xml (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1255/Mappings.hbm.xml 2009-10-16 20:18:56 UTC (rev 4766) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1255" + default-lazy="false"> + + <class name="Customer"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="Name" /> + </class> + + <class name="CustomerValue" > + <composite-id name="Id" class="CustomerValueId"> + <key-many-to-one class="Customer" name="Customer" not-found="ignore" /> + <key-property name="CustomKey" /> + </composite-id> + <property name="Value" /> + </class> + +</hibernate-mapping> \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-16 19:05:59 UTC (rev 4765) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-10-16 20:18:56 UTC (rev 4766) @@ -368,6 +368,8 @@ <Compile Include="NHSpecificTest\ElementsEnums\Something.cs" /> <Compile Include="NHSpecificTest\NH1025\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1025\Model.cs" /> + <Compile Include="NHSpecificTest\NH1255\Domain.cs" /> + <Compile Include="NHSpecificTest\NH1255\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1895\DomainClasses.cs" /> <Compile Include="NHSpecificTest\NH1895\SampleTest.cs" /> <Compile Include="NHSpecificTest\NH1905\Fixture.cs" /> @@ -2007,6 +2009,7 @@ <EmbeddedResource Include="DriverTest\MultiTypeEntity.hbm.xml" /> <EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1255\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1895\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1025\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1985\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-18 13:19:19
|
Revision: 4773 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4773&view=rev Author: fabiomaulo Date: 2009-10-18 13:19:08 +0000 (Sun, 18 Oct 2009) Log Message: ----------- Fix NH-1760 & NH-1476 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Engine/JoinHelper.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/AbstractEntityJoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/IOuterJoinLoadable.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/DomainClass.cs branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/Mappings.hbm.xml branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/SampleTest.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Engine/JoinHelper.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Engine/JoinHelper.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate/Engine/JoinHelper.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -1,4 +1,3 @@ -using System; using NHibernate.Persister.Entity; using NHibernate.Type; using NHibernate.Util; @@ -11,118 +10,150 @@ { } - /// <summary> - /// Get the aliased columns of the owning entity which are to - /// be used in the join - /// </summary> - public static string[] GetAliasedLHSColumnNames( - IAssociationType type, - string alias, - int property, - IOuterJoinLoadable lhsPersister, - IMapping mapping - ) + public static ILhsAssociationTypeSqlInfo GetLhsSqlInfo(string alias, int property, + IOuterJoinLoadable lhsPersister, IMapping mapping) { - return GetAliasedLHSColumnNames(type, alias, property, 0, lhsPersister, mapping); + return new PropertiesLhsAssociationTypeSqlInfo(alias, property, lhsPersister, mapping); } + public static ILhsAssociationTypeSqlInfo GetIdLhsSqlInfo(string alias, IOuterJoinLoadable lhsPersister, IMapping mapping) + { + return new IdPropertiesLhsAssociationTypeSqlInfo(alias, lhsPersister, mapping); + } + /// <summary> - /// Get the columns of the owning entity which are to + /// Get the columns of the associated table which are to /// be used in the join /// </summary> - public static string[] GetLHSColumnNames( - IAssociationType type, - int property, - IOuterJoinLoadable lhsPersister, - IMapping mapping - ) + public static string[] GetRHSColumnNames(IAssociationType type, ISessionFactoryImplementor factory) { - return GetLHSColumnNames(type, property, 0, lhsPersister, mapping); + string uniqueKeyPropertyName = type.RHSUniqueKeyPropertyName; + IJoinable joinable = type.GetAssociatedJoinable(factory); + if (uniqueKeyPropertyName == null) + { + return joinable.KeyColumnNames; + } + else + { + return ((IOuterJoinLoadable)joinable).GetPropertyColumnNames(uniqueKeyPropertyName); + } } + } + public interface ILhsAssociationTypeSqlInfo + { /// <summary> /// Get the aliased columns of the owning entity which are to /// be used in the join /// </summary> - public static string[] GetAliasedLHSColumnNames( - IAssociationType type, - string alias, - int property, - int begin, - IOuterJoinLoadable lhsPersister, - IMapping mapping - ) + string[] GetAliasedColumnNames(IAssociationType type, int begin); + + /// <summary> + /// Get the columns of the owning entity which are to + /// be used in the join + /// </summary> + string[] GetColumnNames(IAssociationType type, int begin); + + string GetTableName(IAssociationType type); + } + + public abstract class AbstractLhsAssociationTypeSqlInfo : ILhsAssociationTypeSqlInfo + { + protected AbstractLhsAssociationTypeSqlInfo(string @alias, IOuterJoinLoadable persister, IMapping mapping) { + Alias = alias; + Persister = persister; + Mapping = mapping; + } + + public string Alias { get; private set; } + + public IOuterJoinLoadable Persister { get; private set; } + + public IMapping Mapping { get; private set; } + + #region Implementation of ILhsAssociationTypeSqlInfo + + + public string[] GetAliasedColumnNames(IAssociationType type, int begin) + { if (type.UseLHSPrimaryKey) { - return StringHelper.Qualify(alias, lhsPersister.IdentifierColumnNames); + return StringHelper.Qualify(Alias, Persister.IdentifierColumnNames); } else { string propertyName = type.LHSPropertyName; if (propertyName == null) { - return ArrayHelper.Slice( - lhsPersister.ToColumns(alias, property), - begin, - type.GetColumnSpan(mapping) - ); + return ArrayHelper.Slice(GetAliasedColumns(), begin, type.GetColumnSpan(Mapping)); } else { - return ((IPropertyMapping) lhsPersister).ToColumns(alias, propertyName); //bad cast + return ((IPropertyMapping)Persister).ToColumns(Alias, propertyName); //bad cast } } } - /// <summary> - /// Get the columns of the owning entity which are to - /// be used in the join - /// </summary> - public static string[] GetLHSColumnNames( - IAssociationType type, - int property, - int begin, - IOuterJoinLoadable lhsPersister, - IMapping mapping - ) + public string[] GetColumnNames(IAssociationType type, int begin) { if (type.UseLHSPrimaryKey) { - //return lhsPersister.getSubclassPropertyColumnNames(property); - return lhsPersister.IdentifierColumnNames; + return Persister.IdentifierColumnNames; } else { string propertyName = type.LHSPropertyName; if (propertyName == null) { - //slice, to get the columns for this component - //property - return ArrayHelper.Slice( - lhsPersister.GetSubclassPropertyColumnNames(property), - begin, - type.GetColumnSpan(mapping) - ); + //slice, to get the columns for this component property + return ArrayHelper.Slice(GetColumns(), begin, type.GetColumnSpan(Mapping)); } else { //property-refs for associations defined on a //component are not supported, so no need to slice - return lhsPersister.GetPropertyColumnNames(propertyName); + return Persister.GetPropertyColumnNames(propertyName); } } } - public static string GetLHSTableName( - IAssociationType type, - int property, - IOuterJoinLoadable lhsPersister - ) + protected abstract string[] GetAliasedColumns(); + protected abstract string[] GetColumns(); + + public abstract string GetTableName(IAssociationType type); + + #endregion + } + + public class PropertiesLhsAssociationTypeSqlInfo : AbstractLhsAssociationTypeSqlInfo + { + private readonly int propertyIdx; + + public PropertiesLhsAssociationTypeSqlInfo(string alias, + int propertyIdx, IOuterJoinLoadable persister, IMapping mapping) + : base(alias, persister, mapping) { + this.propertyIdx = propertyIdx; + } + + #region Overrides of AbstractLhsAssociationTypeSqlInfo + + protected override string[] GetAliasedColumns() + { + return Persister.ToColumns(Alias, propertyIdx); + } + + protected override string[] GetColumns() + { + return Persister.GetSubclassPropertyColumnNames(propertyIdx); + } + + public override string GetTableName(IAssociationType type) + { if (type.UseLHSPrimaryKey) { - return lhsPersister.TableName; + return Persister.TableName; } else { @@ -132,12 +163,12 @@ //if there is no property-ref, assume the join //is to the subclass table (ie. the table of the //subclass that the association belongs to) - return lhsPersister.GetSubclassPropertyTableName(property); + return Persister.GetSubclassPropertyTableName(propertyIdx); } else { //handle a property-ref - string propertyRefTable = lhsPersister.GetPropertyTableName(propertyName); + string propertyRefTable = Persister.GetPropertyTableName(propertyName); if (propertyRefTable == null) { //it is possible that the tree-walking in OuterJoinLoader can get to @@ -147,29 +178,38 @@ //assumes that the property-ref refers to a property of the subclass //table that the association belongs to (a reasonable guess) //TODO: fix this, add: IOuterJoinLoadable.getSubclassPropertyTableName(string propertyName) - propertyRefTable = lhsPersister.GetSubclassPropertyTableName(property); + propertyRefTable = Persister.GetSubclassPropertyTableName(propertyIdx); } return propertyRefTable; } } } - /// <summary> - /// Get the columns of the associated table which are to - /// be used in the join - /// </summary> - public static string[] GetRHSColumnNames(IAssociationType type, ISessionFactoryImplementor factory) + #endregion + } + + public class IdPropertiesLhsAssociationTypeSqlInfo : AbstractLhsAssociationTypeSqlInfo + { + public IdPropertiesLhsAssociationTypeSqlInfo(string alias, IOuterJoinLoadable persister, IMapping mapping) : base(alias, persister, mapping) {} + + #region Overrides of AbstractLhsAssociationTypeSqlInfo + + protected override string[] GetAliasedColumns() { - string uniqueKeyPropertyName = type.RHSUniqueKeyPropertyName; - IJoinable joinable = type.GetAssociatedJoinable(factory); - if (uniqueKeyPropertyName == null) - { - return joinable.KeyColumnNames; - } - else - { - return ((IOuterJoinLoadable) joinable).GetPropertyColumnNames(uniqueKeyPropertyName); - } + return Persister.ToIdentifierColumns(Alias); } + + protected override string[] GetColumns() + { + return Persister.IdentifierColumnNames; + } + + public override string GetTableName(IAssociationType type) + { + return Persister.TableName; + } + + #endregion } + } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/AbstractEntityJoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/AbstractEntityJoinWalker.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/AbstractEntityJoinWalker.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -28,7 +28,7 @@ alias = rootSqlAlias; } - protected void InitAll(SqlString whereString, SqlString orderByString, LockMode lockMode) + protected virtual void InitAll(SqlString whereString, SqlString orderByString, LockMode lockMode) { WalkEntityTree(persister, Alias); IList<OuterJoinableAssociation> allAssociations = new List<OuterJoinableAssociation>(associations); @@ -99,7 +99,7 @@ public abstract string Comment { get; } - protected ILoadable Persister + protected IOuterJoinLoadable Persister { get { return persister; } } Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using Iesi.Collections.Generic; using log4net; @@ -57,6 +58,25 @@ userAliases = ArrayHelper.ToStringArray(userAliasList); } + protected override void InitAll(SqlString whereString, SqlString orderByString, LockMode lockMode) + { + // NH different behavior (NH-1760) + WalkCompositeComponentIdTree(); + base.InitAll(whereString, orderByString, lockMode); + } + + private void WalkCompositeComponentIdTree() + { + IType type = Persister.IdentifierType; + string propertyName = Persister.IdentifierPropertyName; + if (type != null && type.IsComponentType && !(type is EmbeddedComponentType)) + { + ILhsAssociationTypeSqlInfo associationTypeSQLInfo = JoinHelper.GetIdLhsSqlInfo(Alias, Persister, Factory); + WalkComponentTree((IAbstractComponentType) type, 0, Alias, SubPath(string.Empty, propertyName), 0, + associationTypeSQLInfo); + } + } + public IType[] ResultTypes { get { return resultTypes; } Modified: branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate/Loader/JoinWalker.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using Iesi.Collections.Generic; using NHibernate.Collection; using NHibernate.Engine; @@ -218,20 +217,18 @@ } } - private void WalkEntityAssociationTree(IAssociationType associationType, IOuterJoinLoadable persister, int propertyNumber, - string alias, string path, bool nullable, int currentDepth) + private void WalkEntityAssociationTree(IAssociationType associationType, IOuterJoinLoadable persister, + int propertyNumber, string alias, string path, bool nullable, int currentDepth, + ILhsAssociationTypeSqlInfo associationTypeSQLInfo) { - string[] aliasedLhsColumns = - JoinHelper.GetAliasedLHSColumnNames(associationType, alias, propertyNumber, persister, Factory); + string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, 0); + string[] lhsColumns = associationTypeSQLInfo.GetColumnNames(associationType, 0); + string lhsTable = associationTypeSQLInfo.GetTableName(associationType); - string[] lhsColumns = JoinHelper.GetLHSColumnNames(associationType, propertyNumber, persister, Factory); - string lhsTable = JoinHelper.GetLHSTableName(associationType, propertyNumber, persister); - string subpath = SubPath(path, persister.GetSubclassPropertyName(propertyNumber)); - JoinType joinType = - GetJoinType(associationType, persister.GetFetchMode(propertyNumber), subpath, lhsTable, lhsColumns, nullable, - currentDepth, persister.GetCascadeStyle(propertyNumber)); + JoinType joinType = GetJoinType(associationType, persister.GetFetchMode(propertyNumber), subpath, lhsTable, + lhsColumns, nullable, currentDepth, persister.GetCascadeStyle(propertyNumber)); AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType); } @@ -246,15 +243,16 @@ for (int i = 0; i < n; i++) { IType type = persister.GetSubclassPropertyType(i); + ILhsAssociationTypeSqlInfo associationTypeSQLInfo = JoinHelper.GetLhsSqlInfo(alias, i, persister, Factory); if (type.IsAssociationType) { - WalkEntityAssociationTree((IAssociationType)type, persister, i, alias, path, - persister.IsSubclassPropertyNullable(i), currentDepth); + WalkEntityAssociationTree((IAssociationType) type, persister, i, alias, path, + persister.IsSubclassPropertyNullable(i), currentDepth, associationTypeSQLInfo); } else if (type.IsComponentType) { - WalkComponentTree((IAbstractComponentType)type, i, 0, persister, alias, - SubPath(path, persister.GetSubclassPropertyName(i)), currentDepth); + WalkComponentTree((IAbstractComponentType) type, 0, alias, SubPath(path, persister.GetSubclassPropertyName(i)), + currentDepth, associationTypeSQLInfo); } } } @@ -262,8 +260,8 @@ /// <summary> /// For a component, add to a list of associations to be fetched by outerjoin /// </summary> - private void WalkComponentTree(IAbstractComponentType componentType, int propertyNumber, int begin, - IOuterJoinLoadable persister, string alias, string path, int currentDepth) + protected void WalkComponentTree(IAbstractComponentType componentType, int begin, string alias, string path, + int currentDepth, ILhsAssociationTypeSqlInfo associationTypeSQLInfo) { IType[] types = componentType.Subtypes; string[] propertyNames = componentType.PropertyNames; @@ -271,19 +269,18 @@ { if (types[i].IsAssociationType) { - IAssociationType associationType = (IAssociationType)types[i]; - string[] aliasedLhsColumns = - JoinHelper.GetAliasedLHSColumnNames(associationType, alias, propertyNumber, begin, persister, Factory); + var associationType = (IAssociationType) types[i]; - string[] lhsColumns = JoinHelper.GetLHSColumnNames(associationType, propertyNumber, begin, persister, Factory); - string lhsTable = JoinHelper.GetLHSTableName(associationType, propertyNumber, persister); + string[] aliasedLhsColumns = associationTypeSQLInfo.GetAliasedColumnNames(associationType, begin); + string[] lhsColumns = associationTypeSQLInfo.GetColumnNames(associationType, begin); + string lhsTable = associationTypeSQLInfo.GetTableName(associationType); string subpath = SubPath(path, propertyNames[i]); bool[] propertyNullability = componentType.PropertyNullability; - JoinType joinType = - GetJoinType(associationType, componentType.GetFetchMode(i), subpath, lhsTable, lhsColumns, - propertyNullability == null || propertyNullability[i], currentDepth, componentType.GetCascadeStyle(i)); + JoinType joinType = GetJoinType(associationType, componentType.GetFetchMode(i), subpath, lhsTable, lhsColumns, + propertyNullability == null || propertyNullability[i], currentDepth, + componentType.GetCascadeStyle(i)); AddAssociationToJoinTreeIfNecessary(associationType, aliasedLhsColumns, alias, subpath, currentDepth, joinType); } @@ -291,7 +288,7 @@ { string subpath = SubPath(path, propertyNames[i]); - WalkComponentTree((IAbstractComponentType)types[i], propertyNumber, begin, persister, alias, subpath, currentDepth); + WalkComponentTree((IAbstractComponentType) types[i], begin, alias, subpath, currentDepth, associationTypeSQLInfo); } begin += types[i].GetColumnSpan(Factory); } @@ -339,12 +336,9 @@ /// <summary> /// Extend the path by the given property name /// </summary> - private static string SubPath(string path, string property) + protected static string SubPath(string path, string property) { - if (path == null || path.Length == 0) - return property; - else - return StringHelper.Qualify(path, property); + return string.IsNullOrEmpty(path) ? property : StringHelper.Qualify(path, property); } /// <summary> Modified: branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -1852,6 +1852,18 @@ return result; } + public string[] ToIdentifierColumns(string name) + { + string alias = GenerateTableAlias(name, 0); + string[] cols = IdentifierColumnNames; + var result = new string[cols.Length]; + for (int j = 0; j < cols.Length; j++) + { + result[j] = StringHelper.Qualify(alias, cols[j]); + } + return result; + } + private int GetSubclassPropertyIndex(string propertyName) { return Array.IndexOf(subclassPropertyNameClosure, propertyName); Modified: branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/IOuterJoinLoadable.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/IOuterJoinLoadable.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate/Persister/Entity/IOuterJoinLoadable.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -108,5 +108,10 @@ /// Get the table name for the given property path /// </summary> string GetPropertyTableName(string propertyName); + + /// <summary> + /// Return the alised identifier column names + /// </summary> + string[] ToIdentifierColumns(string alias); } } \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/DomainClass.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/DomainClass.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/DomainClass.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -4,22 +4,22 @@ { public class Customer { - public Int32 Id { get; set; } - public String Name { get; set; } + public virtual Int32 Id { get; set; } + public virtual String Name { get; set; } } public class TestClass { - public TestClassId Id { get; set; } - public String Value { get; set; } + public virtual TestClassId Id { get; set; } + public virtual String Value { get; set; } } public class TestClassId { - public Customer Customer { get; set; } - public Int32 SomeInt { get; set; } + public virtual Customer Customer { get; set; } + public virtual Int32 SomeInt { get; set; } - public bool Equals(TestClassId other) + public virtual bool Equals(TestClassId other) { if (ReferenceEquals(null, other)) { Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/Mappings.hbm.xml =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/Mappings.hbm.xml 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/Mappings.hbm.xml 2009-10-18 13:19:08 UTC (rev 4773) @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" - namespace="NHibernate.Test.NHSpecificTest.NH1760" - default-lazy="false"> + namespace="NHibernate.Test.NHSpecificTest.NH1760"> <class name="Customer"> <id name="Id"> Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/SampleTest.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/SampleTest.cs 2009-10-18 01:21:02 UTC (rev 4772) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1760/SampleTest.cs 2009-10-18 13:19:08 UTC (rev 4773) @@ -14,7 +14,7 @@ { var customer = new Customer {Name = "Alkampfer"}; session.Save(customer); - var testClass = new TestClass {Id = new TestClassId{Customer = customer, SomeInt = 42}, Value = "TESTVALUE"}; + var testClass = new TestClass { Id = new TestClassId { Customer = customer, SomeInt = 42 }, Value = "TESTVALUE" }; session.Save(testClass); tx.Commit(); } @@ -25,13 +25,13 @@ using (ISession session = OpenSession()) using (var tx = session.BeginTransaction()) { - session.CreateQuery("from TestClass").ExecuteUpdate(); - session.CreateQuery("from Customer").ExecuteUpdate(); + session.CreateQuery("delete from TestClass").ExecuteUpdate(); + session.CreateQuery("delete from Customer").ExecuteUpdate(); tx.Commit(); } } - [Test, Ignore("Not fixed yet.")] + [Test] public void CanUseCriteria() { FillDb(); @@ -40,7 +40,7 @@ using (ISession session = OpenSession()) { IList<TestClass> retvalue = - session.CreateQuery("Select tc from TestClass tc where tc.Id.Customer.Name = :name").SetString("name", "Alkampfer") + session.CreateQuery("Select tc from TestClass tc join tc.Id.Customer cu where cu.Name = :name").SetString("name", "Alkampfer") .List<TestClass>(); hqlCount = retvalue.Count; } @@ -53,10 +53,31 @@ IList<TestClass> retvalue = c.List<TestClass>(); criteriaCount = retvalue.Count; } - Assert.That(hqlCount == criteriaCount); - Assert.That(hqlCount, Is.EqualTo(1)); + Assert.That(criteriaCount, Is.EqualTo(1)); + Assert.That(criteriaCount, Is.EqualTo(hqlCount)); Cleanup(); } + + [Test] + public void TheJoinShouldBeOptional() + { + FillDb(); + int criteriaCount; + + using (ISession session = OpenSession()) + { + using (var ls = new SqlLogSpy()) + { + ICriteria c = session.CreateCriteria(typeof(TestClass)); + IList<TestClass> retvalue = c.List<TestClass>(); + Assert.That(ls.GetWholeLog(), Text.DoesNotContain("join")); + criteriaCount = retvalue.Count; + } + } + Assert.That(criteriaCount, Is.EqualTo(1)); + + Cleanup(); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-18 15:53:39
|
Revision: 4779 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4779&view=rev Author: fabiomaulo Date: 2009-10-18 15:53:31 +0000 (Sun, 18 Oct 2009) Log Message: ----------- Refactoring to Fix NH-1936 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/PostDeleteEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/PostInsertEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/PostLoadEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/PostUpdateEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/PreLoadEvent.cs branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj Added Paths: ----------- branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPostDatabaseOperationEvent.cs branches/2.1.x/nhibernate/src/NHibernate/Event/IDatabaseEventArgs.cs branches/2.1.x/nhibernate/src/NHibernate/Event/IPostDatabaseOperationEventArgs.cs branches/2.1.x/nhibernate/src/NHibernate/Event/IPreDatabaseOperationEventArgs.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -6,7 +6,7 @@ /// Defines a base class for Session generated events. /// </summary> [Serializable] - public class AbstractEvent + public class AbstractEvent : IDatabaseEventArgs { /// <summary> /// Constructs an event from the given event session. Added: branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPostDatabaseOperationEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPostDatabaseOperationEvent.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPostDatabaseOperationEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -0,0 +1,36 @@ +using System; +using NHibernate.Persister.Entity; + +namespace NHibernate.Event +{ + /// <summary> + /// Represents an operation we performed against the database. + /// </summary> + [Serializable] + public class AbstractPostDatabaseOperationEvent : AbstractEvent, IPostDatabaseOperationEventArgs + { + /// <summary> Constructs an event containing the pertinent information. </summary> + /// <param name="source">The session from which the event originated. </param> + /// <param name="entity">The entity to be invloved in the database operation. </param> + /// <param name="id">The entity id to be invloved in the database operation. </param> + /// <param name="persister">The entity's persister. </param> + protected AbstractPostDatabaseOperationEvent(IEventSource source, object entity, object id, IEntityPersister persister) + : base(source) + { + Entity = entity; + Id = id; + Persister = persister; + } + + /// <summary> The entity involved in the database operation. </summary> + public object Entity { get; private set; } + + /// <summary> The id to be used in the database operation. </summary> + public object Id { get; private set; } + + /// <summary> + /// The persister for the <see cref="Entity"/>. + /// </summary> + public IEntityPersister Persister { get; private set; } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -8,7 +8,7 @@ /// Represents an operation we are about to perform against the database. /// </summary> [Serializable] - public abstract class AbstractPreDatabaseOperationEvent : AbstractEvent + public abstract class AbstractPreDatabaseOperationEvent : AbstractEvent, IPreDatabaseOperationEventArgs { /// <summary> Constructs an event containing the pertinent information. </summary> /// <param name="source">The session from which the event originated. </param> Added: branches/2.1.x/nhibernate/src/NHibernate/Event/IDatabaseEventArgs.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/IDatabaseEventArgs.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/IDatabaseEventArgs.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -0,0 +1,11 @@ +namespace NHibernate.Event +{ + public interface IDatabaseEventArgs + { + /// <summary> + /// Returns the session event source for this event. + /// This is the underlying session from which this event was generated. + /// </summary> + IEventSource Session { get; } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Event/IPostDatabaseOperationEventArgs.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/IPostDatabaseOperationEventArgs.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/IPostDatabaseOperationEventArgs.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -0,0 +1,21 @@ +using NHibernate.Persister.Entity; + +namespace NHibernate.Event +{ + /// <summary> + /// Represents an operation we performed against the database. + /// </summary> + public interface IPostDatabaseOperationEventArgs : IDatabaseEventArgs + { + /// <summary> The entity involved in the database operation. </summary> + object Entity { get; } + + /// <summary> The id to be used in the database operation. </summary> + object Id { get; } + + /// <summary> + /// The persister for the <see cref="Entity"/>. + /// </summary> + IEntityPersister Persister { get; } + } +} \ No newline at end of file Added: branches/2.1.x/nhibernate/src/NHibernate/Event/IPreDatabaseOperationEventArgs.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/IPreDatabaseOperationEventArgs.cs (rev 0) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/IPreDatabaseOperationEventArgs.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -0,0 +1,18 @@ +using NHibernate.Persister.Entity; + +namespace NHibernate.Event +{ + public interface IPreDatabaseOperationEventArgs : IDatabaseEventArgs + { + /// <summary> The entity involved in the database operation. </summary> + object Entity { get; } + + /// <summary> The id to be used in the database operation. </summary> + object Id { get; } + + /// <summary> + /// The persister for the <see cref="Entity"/>. + /// </summary> + IEntityPersister Persister { get; } + } +} \ No newline at end of file Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/PostDeleteEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/PostDeleteEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/PostDeleteEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -7,40 +7,14 @@ /// Occurs after deleting an item from the datastore /// </summary> [Serializable] - public class PostDeleteEvent : AbstractEvent + public class PostDeleteEvent : AbstractPostDatabaseOperationEvent { - private readonly object entity; - private readonly object id; - private readonly IEntityPersister persister; - private readonly object[] deletedState; - public PostDeleteEvent(object entity, object id, object[] deletedState, IEntityPersister persister, IEventSource source) - : base(source) + : base(source, entity, id, persister) { - this.entity = entity; - this.id = id; - this.persister = persister; - this.deletedState = deletedState; + DeletedState = deletedState; } - public object Entity - { - get { return entity; } - } - - public object Id - { - get { return id; } - } - - public IEntityPersister Persister - { - get { return persister; } - } - - public object[] DeletedState - { - get { return deletedState; } - } + public object[] DeletedState { get; private set; } } } Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/PostInsertEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/PostInsertEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/PostInsertEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using NHibernate.Persister.Entity; namespace NHibernate.Event @@ -9,40 +7,14 @@ /// Occurs after inserting an item in the datastore /// </summary> [Serializable] - public class PostInsertEvent : AbstractEvent + public class PostInsertEvent : AbstractPostDatabaseOperationEvent { - private readonly object entity; - private readonly object id; - private readonly object[] state; - private readonly IEntityPersister persister; - public PostInsertEvent(object entity, object id, object[] state, IEntityPersister persister, IEventSource source) - : base(source) + : base(source, entity,id,persister) { - this.entity = entity; - this.id = id; - this.state = state; - this.persister = persister; + State = state; } - public object Entity - { - get { return entity; } - } - - public object Id - { - get { return id; } - } - - public object[] State - { - get { return state; } - } - - public IEntityPersister Persister - { - get { return persister; } - } + public object[] State { get; private set; } } } Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/PostLoadEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/PostLoadEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/PostLoadEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -7,7 +7,7 @@ /// Occurs after an an entity instance is fully loaded. /// </summary> [Serializable] - public class PostLoadEvent : AbstractEvent + public class PostLoadEvent : AbstractEvent, IPostDatabaseOperationEventArgs { private object entity; private object id; Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/PostUpdateEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/PostUpdateEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/PostUpdateEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using NHibernate.Persister.Entity; namespace NHibernate.Event @@ -9,47 +7,17 @@ /// Occurs after the datastore is updated /// </summary> [Serializable] - public class PostUpdateEvent : AbstractEvent + public class PostUpdateEvent : AbstractPostDatabaseOperationEvent { - private readonly object entity; - private readonly object id; - private readonly object[] state; - private readonly object[] oldState; - private readonly IEntityPersister persister; - public PostUpdateEvent(object entity, object id, object[] state, object[] oldState, IEntityPersister persister, IEventSource source) - : base(source) + : base(source, entity, id, persister) { - this.entity = entity; - this.id = id; - this.state = state; - this.oldState = oldState; - this.persister = persister; + State = state; + OldState = oldState; } - public object Entity - { - get { return entity; } - } + public object[] State { get; private set; } - public object Id - { - get { return id; } - } - - public object[] State - { - get { return state; } - } - - public object[] OldState - { - get { return oldState; } - } - - public IEntityPersister Persister - { - get { return persister; } - } + public object[] OldState { get; private set; } } } Modified: branches/2.1.x/nhibernate/src/NHibernate/Event/PreLoadEvent.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Event/PreLoadEvent.cs 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/Event/PreLoadEvent.cs 2009-10-18 15:53:31 UTC (rev 4779) @@ -7,7 +7,7 @@ /// Called before injecting property values into a newly loaded entity instance. /// </summary> [Serializable] - public class PreLoadEvent : AbstractEvent + public class PreLoadEvent : AbstractEvent, IPreDatabaseOperationEventArgs { private object entity; private object[] state; Modified: branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-10-18 14:50:49 UTC (rev 4778) +++ branches/2.1.x/nhibernate/src/NHibernate/NHibernate.csproj 2009-10-18 15:53:31 UTC (rev 4779) @@ -480,8 +480,12 @@ <Compile Include="Driver\IfxDriver.cs" /> <Compile Include="Driver\OracleLiteDataClientDriver.cs" /> <Compile Include="EntityModeEqualityComparer.cs" /> + <Compile Include="Event\AbstractPostDatabaseOperationEvent.cs" /> <Compile Include="Event\AbstractPreDatabaseOperationEvent.cs" /> <Compile Include="Event\IDestructible.cs" /> + <Compile Include="Event\IDatabaseEventArgs.cs" /> + <Compile Include="Event\IPostDatabaseOperationEventArgs.cs" /> + <Compile Include="Event\IPreDatabaseOperationEventArgs.cs" /> <Compile Include="Exceptions\AdoExceptionContextInfo.cs" /> <Compile Include="Exceptions\ReflectionBasedSqlStateExtracter.cs" /> <Compile Include="Exceptions\SqlStateExtracter.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-18 16:11:50
|
Revision: 4781 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4781&view=rev Author: fabiomaulo Date: 2009-10-18 16:11:42 +0000 (Sun, 18 Oct 2009) Log Message: ----------- Fix NH-1980 Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs branches/2.1.x/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs 2009-10-18 15:59:11 UTC (rev 4780) +++ branches/2.1.x/nhibernate/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs 2009-10-18 16:11:42 UTC (rev 4781) @@ -108,7 +108,7 @@ { throw new HibernateByteCodeException(type.FullName + " does not implement " + typeof(ICollectionTypeFactory).FullName); } - if (collectionTypeFactory != null) + if (collectionTypeFactory != null && !collectionTypeFactoryClass.Equals(type)) { throw new InvalidOperationException("CollectionTypeFactory in use, can't change it."); } Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs 2009-10-18 15:59:11 UTC (rev 4780) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs 2009-10-18 16:11:42 UTC (rev 4781) @@ -123,7 +123,7 @@ var bcp = new BytecodeProviderImpl(); ctf = bcp.CollectionTypeFactory; // initialize the instance // try to set it - Assert.Throws<InvalidOperationException>(() => bcp.SetCollectionTypeFactoryClass(typeof(Type.DefaultCollectionTypeFactory))); + Assert.Throws<InvalidOperationException>(() => bcp.SetCollectionTypeFactoryClass(typeof(CustomCollectionTypeFactory))); } private class CustomCollectionTypeFactory : Type.DefaultCollectionTypeFactory @@ -153,5 +153,15 @@ cfg.AddResource("NHibernate.Test.Bytecode.Lightweight.ProductLine.hbm.xml", GetType().Assembly); Assert.That(Environment.BytecodeProvider.CollectionTypeFactory, Is.TypeOf<CustomCollectionTypeFactory>()); } + + [Test] + [Explicit("The BytecodeProvider is static and can't be different in the same application.")] + public void ShouldNotThrownAnExceptionWithTheSameTypeOfCollectionTypeFactory() + { + ICollectionTypeFactory ctf; + var bcp = new BytecodeProviderImpl(); + ctf = bcp.CollectionTypeFactory; // initialize the instance + Assert.DoesNotThrow(() => bcp.SetCollectionTypeFactoryClass(typeof (Type.DefaultCollectionTypeFactory))); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |