diff --git a/Spring.Net.2008.sln b/Spring.Net.2008.sln index f7a61466..6a40b97a 100644 --- a/Spring.Net.2008.sln +++ b/Spring.Net.2008.sln @@ -70,6 +70,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate30.Te EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate21.Integration.Tests.2008", "test\Spring\Spring.Data.NHibernate21.Integration.Tests\Spring.Data.NHibernate21.Integration.Tests.2008.csproj", "{4A07E150-ED90-407C-8CAD-4760444DDFD9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.2008", "src\Spring\Spring.Data.NHibernate31\Spring.Data.NHibernate31.2008.csproj", "{1C8E0481-A70D-445E-AB4D-4A963CF7DC83}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.Tests.2008", "test\Spring\Spring.Data.NHibernate31.Tests\Spring.Data.NHibernate31.Tests.2008.csproj", "{231512F3-4F1D-45E1-BADE-D01F68DB9A80}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -410,6 +414,26 @@ Global {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Any CPU.Build.0 = Release|Any CPU {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Debug|.NET.ActiveCfg = Debug|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Release|.NET.ActiveCfg = Release|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Release|Any CPU.Build.0 = Release|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Debug|.NET.ActiveCfg = Debug|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Release|.NET.ActiveCfg = Release|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Release|Any CPU.Build.0 = Release|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {231512F3-4F1D-45E1-BADE-D01F68DB9A80}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Spring.Net.2010.sln b/Spring.Net.2010.sln index b1bea551..870fe369 100644 --- a/Spring.Net.2010.sln +++ b/Spring.Net.2010.sln @@ -74,6 +74,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Mvc.2010", "src\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Mvc.Tests.2010", "test\Spring\Spring.Web.Mvc.Tests\Spring.Web.Mvc.Tests.2010.csproj", "{D4032434-D9A8-437B-95E8-9D4DE0AD9932}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.2010", "src\Spring\Spring.Data.NHibernate31\Spring.Data.NHibernate31.2010.csproj", "{D85818E0-A6BC-42B8-B988-4ACA82C85806}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.Tests.2010", "test\Spring\Spring.Data.NHibernate31.Tests\Spring.Data.NHibernate31.Tests.2010.csproj", "{DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -434,6 +438,26 @@ Global {D4032434-D9A8-437B-95E8-9D4DE0AD9932}.Release|Any CPU.Build.0 = Release|Any CPU {D4032434-D9A8-437B-95E8-9D4DE0AD9932}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {D4032434-D9A8-437B-95E8-9D4DE0AD9932}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Debug|.NET.ActiveCfg = Debug|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Release|.NET.ActiveCfg = Release|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Release|Any CPU.Build.0 = Release|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D85818E0-A6BC-42B8-B988-4ACA82C85806}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Debug|.NET.ActiveCfg = Debug|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Release|.NET.ActiveCfg = Release|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Release|Any CPU.Build.0 = Release|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB2AE3AC-2869-4A8E-9C96-FC59E5F18DFC}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Spring.build b/Spring.build index e03d5baa..b46e5ed9 100644 --- a/Spring.build +++ b/Spring.build @@ -462,6 +462,7 @@ Commandline Examples: + @@ -469,12 +470,13 @@ Commandline Examples: - + + @@ -506,6 +508,14 @@ Commandline Examples: if="${build-data and nant.settings.currentframework == 'net-4.0'}"/> + + + + @@ -578,6 +588,7 @@ Commandline Examples: depends="set-net-3.5-runtime-configuration, check-spring-basedir, clean-current-bin-dir"> + @@ -599,6 +610,7 @@ Commandline Examples: + + + @@ -874,6 +888,10 @@ Commandline Examples: + + + + @@ -1267,7 +1285,7 @@ Commandline Examples: - + @@ -1279,7 +1297,7 @@ Commandline Examples: - + @@ -1291,7 +1309,7 @@ Commandline Examples: - + @@ -1303,11 +1321,23 @@ Commandline Examples: - + + + + + + + + + + + + + @@ -1462,6 +1492,10 @@ Commandline Examples: + + + + @@ -1746,7 +1780,7 @@ Commandline Examples: - + @@ -1754,7 +1788,8 @@ Commandline Examples: - + + @@ -1777,8 +1812,10 @@ Commandline Examples: - + + + diff --git a/build-support/solutions/Spring.Net.NHibernate31.2008.sln b/build-support/solutions/Spring.Net.NHibernate31.2008.sln new file mode 100644 index 00000000..e36fba9c --- /dev/null +++ b/build-support/solutions/Spring.Net.NHibernate31.2008.sln @@ -0,0 +1,155 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F04753EF-7A1B-4837-AB63-8C0821E8155D}" + ProjectSection(SolutionItems) = preProject + ..\..\Spring.build = ..\..\Spring.build + ..\..\src\Spring\Spring.Data.NHibernate30\Spring.Data.NHibernate30.build = ..\..\src\Spring\Spring.Data.NHibernate30\Spring.Data.NHibernate30.build + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.2008", "..\..\src\Spring\Spring.Core\Spring.Core.2008.csproj", "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aop.2008", "..\..\src\Spring\Spring.Aop\Spring.Aop.2008.csproj", "{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.2008", "..\..\src\Spring\Spring.Data\Spring.Data.2008.csproj", "{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.Integration.Tests.2008", "..\..\test\Spring\Spring.Data.NHibernate31.Integration.Tests\Spring.Data.NHibernate31.Integration.Tests.2008.csproj", "{93FED0CE-0B01-43AF-8CB1-244CC7C3308B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.Tests.2008", "..\..\test\Spring\Spring.Data.NHibernate31.Tests\Spring.Data.NHibernate31.Tests.2008.csproj", "{E4CCB8A2-2381-41D1-B44C-E20E13703056}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate31.2008", "..\..\src\Spring\Spring.Data.NHibernate31\Spring.Data.NHibernate31.2008.csproj", "{009247FE-CBAD-40FF-ADC3-D7F28B270071}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.Tests.2008", "..\..\test\Spring\Spring.Data.Tests\Spring.Data.Tests.2008.csproj", "{ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.Tests.2008", "..\..\test\Spring\Spring.Core.Tests\Spring.Core.Tests.2008.csproj", "{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Template.Velocity.2008", "..\..\src\Spring\Spring.Template.Velocity\Spring.Template.Velocity.2008.csproj", "{BF3AB954-8375-407C-9E98-4C51D8072784}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Services.2008", "..\..\src\Spring\Spring.Services\Spring.Services.2008.csproj", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Messaging.Nms.2008", "..\..\src\Spring\Spring.Messaging.Nms\Spring.Messaging.Nms.2008.csproj", "{AEB1578C-9018-4D49-B440-789F38DD2F29}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|.NET = Debug|.NET + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Release|.NET = Release|.NET + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|.NET.ActiveCfg = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|.NET.Build.0 = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|.NET.ActiveCfg = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|.NET.Build.0 = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.Build.0 = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|.NET.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|.NET.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|.NET.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|.NET.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|.NET.ActiveCfg = Debug|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|.NET.Build.0 = Debug|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|.NET.ActiveCfg = Release|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|.NET.Build.0 = Release|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Any CPU.Build.0 = Release|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Debug|.NET.ActiveCfg = Debug|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Release|.NET.ActiveCfg = Release|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {93FED0CE-0B01-43AF-8CB1-244CC7C3308B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|.NET.ActiveCfg = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|.NET.ActiveCfg = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|.NET.ActiveCfg = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|.NET.ActiveCfg = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|Any CPU.ActiveCfg = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Debug|.NET.ActiveCfg = Debug|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Release|.NET.ActiveCfg = Release|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Release|Any CPU.Build.0 = Release|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Debug|.NET.ActiveCfg = Debug|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|.NET.ActiveCfg = Release|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Any CPU.Build.0 = Release|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Debug|.NET.ActiveCfg = Debug|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Release|.NET.ActiveCfg = Release|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Release|Any CPU.Build.0 = Release|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {BF3AB954-8375-407C-9E98-4C51D8072784}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|.NET.ActiveCfg = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|.NET.ActiveCfg = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Any CPU.Build.0 = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Debug|.NET.ActiveCfg = Debug|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Release|.NET.ActiveCfg = Release|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Release|Any CPU.Build.0 = Release|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AEB1578C-9018-4D49-B440-789F38DD2F29}.Release|Mixed Platforms.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + NAntAddinLastFileName = Spring.build + EndGlobalSection +EndGlobal diff --git a/lib/NHibernate31/net/3.5/Iesi.Collections.dll b/lib/NHibernate31/net/3.5/Iesi.Collections.dll new file mode 100644 index 00000000..848ca527 Binary files /dev/null and b/lib/NHibernate31/net/3.5/Iesi.Collections.dll differ diff --git a/lib/NHibernate31/net/3.5/Iesi.Collections.license.txt b/lib/NHibernate31/net/3.5/Iesi.Collections.license.txt new file mode 100644 index 00000000..66c4a8dc --- /dev/null +++ b/lib/NHibernate31/net/3.5/Iesi.Collections.license.txt @@ -0,0 +1,9 @@ +Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. + +Copied from http://www.codeproject.com/csharp/sets.asp#xx703510xx that was posted by JasonSmith 12:13 2 Jan '04 + +Feel free to use this code any way you want to. As a favor to me, you can leave the copyright in there. You never know when someone might recognize your name! + +If you do use the code in a commercial product, I would appreciate hearing about it. This message serves as legal notice that I won't be suing you for royalties! The code is in the public domain. + +On the other hand, I don't provide support. The code is actually simple enough that it shouldn't need it. diff --git a/lib/NHibernate31/net/3.5/NHibernate.dll b/lib/NHibernate31/net/3.5/NHibernate.dll new file mode 100644 index 00000000..21232aaa Binary files /dev/null and b/lib/NHibernate31/net/3.5/NHibernate.dll differ diff --git a/lib/NHibernate31/net/3.5/NHibernate.license.txt b/lib/NHibernate31/net/3.5/NHibernate.license.txt new file mode 100644 index 00000000..8a88d148 --- /dev/null +++ b/lib/NHibernate31/net/3.5/NHibernate.license.txt @@ -0,0 +1,460 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + diff --git a/lib/NHibernate31/net/4.0/Iesi.Collections.dll b/lib/NHibernate31/net/4.0/Iesi.Collections.dll new file mode 100644 index 00000000..848ca527 Binary files /dev/null and b/lib/NHibernate31/net/4.0/Iesi.Collections.dll differ diff --git a/lib/NHibernate31/net/4.0/Iesi.Collections.license.txt b/lib/NHibernate31/net/4.0/Iesi.Collections.license.txt new file mode 100644 index 00000000..66c4a8dc --- /dev/null +++ b/lib/NHibernate31/net/4.0/Iesi.Collections.license.txt @@ -0,0 +1,9 @@ +Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. + +Copied from http://www.codeproject.com/csharp/sets.asp#xx703510xx that was posted by JasonSmith 12:13 2 Jan '04 + +Feel free to use this code any way you want to. As a favor to me, you can leave the copyright in there. You never know when someone might recognize your name! + +If you do use the code in a commercial product, I would appreciate hearing about it. This message serves as legal notice that I won't be suing you for royalties! The code is in the public domain. + +On the other hand, I don't provide support. The code is actually simple enough that it shouldn't need it. diff --git a/lib/NHibernate31/net/4.0/NHibernate.dll b/lib/NHibernate31/net/4.0/NHibernate.dll new file mode 100644 index 00000000..21232aaa Binary files /dev/null and b/lib/NHibernate31/net/4.0/NHibernate.dll differ diff --git a/lib/NHibernate31/net/4.0/NHibernate.license.txt b/lib/NHibernate31/net/4.0/NHibernate.license.txt new file mode 100644 index 00000000..8a88d148 --- /dev/null +++ b/lib/NHibernate31/net/4.0/NHibernate.license.txt @@ -0,0 +1,460 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + diff --git a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs index ab2cccfb..ffb7938a 100644 --- a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs +++ b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs @@ -1,682 +1,682 @@ -#region License - -/* - * Copyright © 2002-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#endregion - -#region Imports - -using System; -using System.Collections; -using Common.Logging; -using Spring.Aop.Framework; -using Spring.Data.Common; -using Spring.Data.Support; -using IInterceptor = NHibernate.IInterceptor; - -using NHibernate; -using NHibernate.Type; -using Spring.Dao; -using Spring.Objects.Factory; - -#endregion - -namespace Spring.Data.NHibernate -{ - /// - /// Helper class that simplifies NHibernate data access code - /// - /// - ///

Typically used to implement data access or business logic services that - /// use NHibernate within their implementation but are Hibernate-agnostic in their - /// interface. The latter or code calling the latter only have to deal with - /// domain objects.

- /// - ///

The central method is Execute supporting Hibernate access code - /// implementing the HibernateCallback interface. It provides NHibernate Session - /// handling such that neither the IHibernateCallback implementation nor the calling - /// code needs to explicitly care about retrieving/closing NHibernate Sessions, - /// or handling Session lifecycle exceptions. For typical single step actions, - /// there are various convenience methods (Find, Load, SaveOrUpdate, Delete). - ///

- /// - ///

Can be used within a service implementation via direct instantiation - /// with a ISessionFactory reference, or get prepared in an application context - /// and given to services as an object reference. Note: The ISessionFactory should - /// always be configured as an object in the application context, in the first case - /// given to the service directly, in the second case to the prepared template. - ///

- /// - ///

This class can be considered as direct alternative to working with the raw - /// Hibernate Session API (through SessionFactoryUtils.Session). - ///

- /// - ///

LocalSessionFactoryObject is the preferred way of obtaining a reference - /// to a specific NHibernate ISessionFactory. - ///

- ///
- /// Mark Pollack (.NET) - public class HibernateTemplate : HibernateAccessor, IHibernateOperations - { - #region Fields - - /// - /// The instance for this class. - /// - private readonly ILog log = LogManager.GetLogger(typeof(HibernateTemplate)); - - private bool checkWriteOperations = true; - - - private bool exposeNativeSession = false; - - private bool alwaysUseNewSession = false; - private int maxResults = 0; - private TemplateFlushMode templateFlushMode = TemplateFlushMode.Auto; - private bool allowCreate = true; - private ISessionFactory sessionFactory; - private object entityInterceptor; - private IObjectFactory objectFactory; - private bool cacheQueries = false; - private string queryCacheRegion; - private int fetchSize = 0; - - private IAdoExceptionTranslator adoExceptionTranslator; - - private readonly object syncRoot = new object(); - private ProxyFactory sessionProxyFactory; - - #endregion - - #region Constructor (s) - /// - /// Initializes a new instance of the class. - /// - public HibernateTemplate() - { - - } - - /// - /// Initializes a new instance of the class. - /// - /// The default for creating a new non-transactional - /// session when no transactional Session can be found for the current thread - /// is set to true. - /// The session factory to create sessions. - public HibernateTemplate(ISessionFactory sessionFactory) - { - SessionFactory = sessionFactory; - AfterPropertiesSet(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The session factory to create sessions. - /// if set to true allow creation - /// of a new non-transactional when no transactional Session can be found - /// for the current thread. - public HibernateTemplate(ISessionFactory sessionFactory, bool allowCreate) - { - SessionFactory = sessionFactory; - AllowCreate = allowCreate; - AfterPropertiesSet(); - } - #endregion - - #region Properties - - /// - /// Gets or sets if a new Session should be created when no transactional Session - /// can be found for the current thread. - /// - /// - /// true if allowed to create non-transaction session; - /// otherwise, false. - /// - /// - ///

HibernateTemplate is aware of a corresponding Session bound to the - /// current thread, for example when using HibernateTransactionManager. - /// If allowCreate is true, a new non-transactional Session will be created - /// if none found, which needs to be closed at the end of the operation. - /// If false, an InvalidOperationException will get thrown in this case. - ///

- ///
- public override bool AllowCreate - { - get - { - - return allowCreate; - } - set { allowCreate = value; } - } - - /// - /// Gets or sets a value indicating whether to always - /// use a new Hibernate Session for this template. - /// - /// true if always use new session; otherwise, false. - /// - ///

- /// Default is "false"; if activated, all operations on this template will - /// work on a new NHibernate ISession even in case of a pre-bound ISession - /// (for example, within a transaction). - ///

- ///

Within a transaction, a new NHibernate ISession used by this template - /// will participate in the transaction through using the same ADO.NET - /// Connection. In such a scenario, multiple Sessions will participate - /// in the same database transaction. - ///

- ///

Turn this on for operations that are supposed to always execute - /// independently, without side effects caused by a shared NHibernate ISession. - ///

- ///
- public override bool AlwaysUseNewSession - { - get { return alwaysUseNewSession; } - set { alwaysUseNewSession = value; } - } - - - /// - /// Gets or sets the template flush mode. - /// - /// - /// Default is Auto. Will get applied to any new ISession - /// created by the template. - /// - /// The template flush mode. - public override TemplateFlushMode TemplateFlushMode - { - get { return templateFlushMode; } - set { templateFlushMode = value; } - } - - /// - /// Gets or sets the entity interceptor that allows to inspect and change - /// property values before writing to and reading from the database. - /// - /// - /// Will get applied to any new ISession created by this object. - ///

Such an interceptor can either be set at the ISessionFactory level, - /// i.e. on LocalSessionFactoryObject, or at the ISession level, i.e. on - /// HibernateTemplate, HibernateInterceptor, and HibernateTransactionManager. - /// It's preferable to set it on LocalSessionFactoryObject or HibernateTransactionManager - /// to avoid repeated configuration and guarantee consistent behavior in transactions. - ///

- ///
- /// The interceptor. - /// If object factory is not set and need to retrieve entity interceptor by name. - public override IInterceptor EntityInterceptor - { - get - { - if (this.entityInterceptor is string) - { - if (this.objectFactory == null) - { - throw new InvalidOperationException("Cannot get entity interceptor via object name if no object factory set"); - } - return (IInterceptor)this.objectFactory.GetObject((String)this.entityInterceptor, typeof(IInterceptor)); - } - - return (IInterceptor)entityInterceptor; - } - set - { - entityInterceptor = value; - } - } - /// - /// Gets or sets the name of the cache region for queries executed by this template. - /// - /// - /// If this is specified, it will be applied to all IQuery and ICriteria objects - /// created by this template (including all queries through find methods). - ///

The cache region will not take effect unless queries created by this - /// template are configured to be cached via the CacheQueries property. - ///

- ///
- /// The query cache region. - public override string QueryCacheRegion - { - get { return queryCacheRegion; } - set { queryCacheRegion = value; } - } - - - /// - /// Gets or sets a value indicating whether to - /// cache all queries executed by this template. - /// - /// - /// If this is true, all IQuery and ICriteria objects created by - /// this template will be marked as cacheable (including all - /// queries through find methods). - ///

To specify the query region to be used for queries cached - /// by this template, set the QueryCacheRegion property. - ///

- ///
- /// true if cache queries; otherwise, false. - public override bool CacheQueries - { - get { return cacheQueries; } - set { cacheQueries = value; } - } - - /// - /// Gets or sets the maximum number of rows for this HibernateTemplate. - /// - /// The max results. - /// - /// This is important - /// for processing subsets of large result sets, avoiding to read and hold - /// the entire result set in the database or in the ADO.NET driver if we're - /// never interested in the entire result in the first place (for example, - /// when performing searches that might return a large number of matches). - ///

Default is 0, indicating to use the driver's default.

- ///
- public override int MaxResults - { - get { return maxResults; } - set { maxResults = value; } - } - - /// - /// Set whether to expose the native Hibernate Session to IHibernateCallback - /// code. Default is "false": a Session proxy will be returned, - /// suppressing close calls and automatically applying - /// query cache settings and transaction timeouts. - /// - /// true if expose native session; otherwise, false. - public override bool ExposeNativeSession - { - get { return exposeNativeSession; } - set { exposeNativeSession = value; } - } - /// - /// Gets or sets whether to check that the Hibernate Session is not in read-only mode - /// in case of write operations (save/update/delete). - /// - /// - /// true if check that the Hibernate Session is not in read-only mode - /// in case of write operations; otherwise, false. - /// - /// - /// Default is "true", for fail-fast behavior when attempting write operations - /// within a read-only transaction. Turn this off to allow save/update/delete - /// on a Session with flush mode NEVER. - /// - public virtual bool CheckWriteOperations - { - get { return checkWriteOperations; } - set { checkWriteOperations = value; } - } - - /// - /// Set the object name of a Hibernate entity interceptor that allows to inspect - /// and change property values before writing to and reading from the database. - /// - /// - /// Will get applied to any new Session created by this transaction manager. - ///

Requires the object factory to be known, to be able to resolve the object - /// name to an interceptor instance on session creation. Typically used for - /// prototype interceptors, i.e. a new interceptor instance per session. - ///

- ///

Can also be used for shared interceptor instances, but it is recommended - /// to set the interceptor reference directly in such a scenario. - ///

- ///
- /// The name of the entity interceptor in the object factory/application context. - public override string EntityInterceptorObjectName - { - set - { - this.entityInterceptor = value; - } - } - - /// - /// Set the object factory instance. - /// - /// The object factory instance - public override IObjectFactory ObjectFactory - { - set - { - objectFactory = value; - } - } - - /// - /// Gets or sets the session factory that should be used to create - /// NHibernate ISessions. - /// - /// The session factory. - public override ISessionFactory SessionFactory - { - get { return sessionFactory; } - set - { - sessionFactory = value; - } - } - - /// - /// Gets or sets the fetch size for this HibernateTemplate. - /// - /// The size of the fetch. - /// This is important for processing - /// large result sets: Setting this higher than the default value will increase - /// processing speed at the cost of memory consumption; setting this lower can - /// avoid transferring row data that will never be read by the application. - ///

Default is 0, indicating to use the driver's default.

- ///
- public override int FetchSize - { - get { return fetchSize; } - set { fetchSize = value; } - } - - - /// - /// Gets or sets the proxy factory. - /// - /// This may be useful to set if you create many instances of - /// HibernateTemplate and/or HibernateDaoSupport. This allows the same - /// ProxyFactory implementation to be used thereby limiting the - /// number of dynamic proxy types created in the temporary assembly, which - /// are never garbage collected due to .NET runtime semantics. - /// - /// The proxy factory. - public virtual ProxyFactory ProxyFactory - { - get { return sessionProxyFactory; } - set { sessionProxyFactory = value; } - } - - #endregion - - #region IHibernateOperations Members - - /// - /// Set the ADO.NET exception translator for this instance. - /// Applied to System.Data.Common.DbException (or provider specific exception type - /// in .NET 1.1) thrown by callback code, be it direct - /// DbException or wrapped Hibernate ADOExceptions. - ///

The default exception translator is either a ErrorCodeExceptionTranslator - /// if a DbProvider is available, or a FalbackExceptionTranslator otherwise - ///

- ///
- /// The ADO exception translator. - public override IAdoExceptionTranslator AdoExceptionTranslator - { - set { adoExceptionTranslator = value; } - get - { - if (adoExceptionTranslator == null) - { - adoExceptionTranslator = SessionFactoryUtils.NewAdoExceptionTranslator(SessionFactory); - } - return adoExceptionTranslator; - } - } - - - /// - /// Delegate function that clears the session. - /// - /// The hibernate session. - /// null - protected object ClearAction(ISession session) - { - session.Clear(); - return null; - } - - /// - /// Flush all pending saves, updates and deletes to the database. - /// - /// - /// Only invoke this for selective eager flushing, for example when ADO.NET code - /// needs to see certain changes within the same transaction. Else, it's preferable - /// to rely on auto-flushing at transaction completion. - /// - /// In case of Hibernate errors - public void Flush() - { - Execute(new HibernateDelegate(FlushAction), true); - } - - private object FlushAction(ISession session) - { - session.Flush(); - return null; - } - - /// - /// Return the persistent instance of the given entity type - /// with the given identifier, or null if not found. - /// - /// The type. - /// An identifier of the persistent instance. - /// The persistent instance, or null if not found - /// In case of Hibernate errors - public object Get(Type entityType, object id) - { - return Get(entityType, id, null); - } - - /// - /// Return the persistent instance of the given entity type - /// with the given identifier, or null if not found. - /// Obtains the specified lock mode if the instance exists. - /// - /// The type. - /// The lock mode to obtain. - /// The lock mode. - /// the persistent instance, or null if not found - /// the persistent instance, or null if not found - /// In case of Hibernate errors - public object Get(Type type, object id, LockMode lockMode) - { - return Execute(new GetByTypeHibernateCallback(type, id, lockMode),true); - - } - - /// - /// Return the persistent instance of the given entity class - /// with the given identifier, throwing an exception if not found. - /// - /// Type of the entity. - /// An identifier of the persistent instance. - /// The persistent instance - /// If not found - /// In case of Hibernate errors - public object Load(Type entityType, object id) - { - return Load(entityType, id, null); - } - - /// - /// Return the persistent instance of the given entity class - /// with the given identifier, throwing an exception if not found. - /// Obtains the specified lock mode if the instance exists. - /// - /// Type of the entity. - /// An identifier of the persistent instance. - /// The lock mode. - /// The persistent instance - /// If not found - /// In case of Hibernate errors - public object Load(Type entityType, object id, LockMode lockMode) - { - return Execute(new LoadByTypeHibernateCallback(entityType, id, lockMode),true); - - } - - /// - /// Load the persistent instance with the given identifier - /// into the given object, throwing an exception if not found. - /// - /// Entity the object (of the target class) to load into. - /// An identifier of the persistent instance. - /// If object not found. - /// In case of Hibernate errors - public void Load(object entity, object id) - { - Execute(new LoadByEntityHibernateCallback(entity, id),true); - } - - /// - /// Return all persistent instances of the given entity class. - /// Note: Use queries or criteria for retrieving a specific subset. - /// - /// Type of the entity. - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList LoadAll(Type entityType) - { - return (IList)Execute(new LoadAllByTypeHibernateCallback(this, entityType),true); - } - - /// - /// Re-read the state of the given persistent instance. - /// - /// The persistent instance to re-read. - /// In case of Hibernate errors - public void Refresh(object entity) - { - Refresh(entity, null); - } - - /// - /// Re-read the state of the given persistent instance. - /// Obtains the specified lock mode for the instance. - /// - /// The persistent instance to re-read. - /// The lock mode to obtain. - /// In case of Hibernate errors - public void Refresh(object entity, LockMode lockMode) - { - Execute(new RefreshHibernateCallback(entity, lockMode),true); - } - - /// - /// Obtain the specified lock level upon the given object, implicitly - /// checking whether the corresponding database entry still exists - /// (throwing an OptimisticLockingFailureException if not found). - /// - /// The he persistent instance to lock. - /// The lock mode to obtain. - /// If not found - /// In case of Hibernate errors - public void Lock(object entity, LockMode lockMode) - { - Execute(new LockHibernateCallback(entity, lockMode),true); - } - - /// - /// Persist the given transient instance. - /// - /// The transient instance to persist. - /// The generated identifier. - /// In case of Hibernate errors - public object Save(object entity) - { - return Execute(new SaveObjectHibernateCallback(this, entity),true); - } - - /// - /// Persist the given transient instance with the given identifier. - /// - /// The transient instance to persist. - /// The identifier to assign. - /// In case of Hibernate errors - public void Save(object entity, object id) - { - Execute(new SaveObjectWithIdHibernateCallback(this, entity, id),true); - } - - /// - /// Update the given persistent instance. - /// - /// The persistent instance to update. - /// In case of Hibernate errors - public void Update(object entity) - { - Update(entity, null); - } - - /// - /// Update the given persistent instance. - /// Obtains the specified lock mode if the instance exists, implicitly - /// checking whether the corresponding database entry still exists - /// (throwing an OptimisticLockingFailureException if not found). - /// - /// The persistent instance to update. - /// The lock mode to obtain. - /// In case of Hibernate errors - public void Update(object entity, LockMode lockMode) - { - Execute(new UpdateObjectHibernateCallback(this, entity, lockMode),true); - } - - /// - /// Save or update the given persistent instance, - /// according to its id (matching the configured "unsaved-value"?). - /// - /// Tthe persistent instance to save or update - /// (to be associated with the Hibernate Session). - /// In case of Hibernate errors - public void SaveOrUpdate(object entity) - { - Execute(new SaveOrUpdateObjectHibernateCallback(this, entity),true); - } - - /// - /// Save or update all given persistent instances, - /// according to its id (matching the configured "unsaved-value"?). - /// - /// Tthe persistent instances to save or update - /// (to be associated with the Hibernate Session)he entities. - /// In case of Hibernate errors - public void SaveOrUpdateAll(ICollection entities) - { - Execute(new SaveOrUpdateAllHibernateCallback(this, entities), true); - } - - /// - /// Save or update the contents of given persistent object, - /// according to its id (matching the configured "unsaved-value"?). - /// Will copy the contained fields to an already loaded instance - /// with the same id, if appropriate. - /// - /// The persistent object to save or update. - /// (not necessarily to be associated with the Hibernate Session) - /// - /// The actually associated persistent object. - /// (either an already loaded instance with the same id, or the given object) - /// In case of Hibernate errors - public object SaveOrUpdateCopy(object entity) - { - return Execute(new SaveOrUpdateCopyHibernateCallback(this, entity),true); +#region License + +/* + * Copyright © 2002-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#endregion + +#region Imports + +using System; +using System.Collections; +using Common.Logging; +using Spring.Aop.Framework; +using Spring.Data.Common; +using Spring.Data.Support; +using IInterceptor = NHibernate.IInterceptor; + +using NHibernate; +using NHibernate.Type; +using Spring.Dao; +using Spring.Objects.Factory; + +#endregion + +namespace Spring.Data.NHibernate +{ + /// + /// Helper class that simplifies NHibernate data access code + /// + /// + ///

Typically used to implement data access or business logic services that + /// use NHibernate within their implementation but are Hibernate-agnostic in their + /// interface. The latter or code calling the latter only have to deal with + /// domain objects.

+ /// + ///

The central method is Execute supporting Hibernate access code + /// implementing the HibernateCallback interface. It provides NHibernate Session + /// handling such that neither the IHibernateCallback implementation nor the calling + /// code needs to explicitly care about retrieving/closing NHibernate Sessions, + /// or handling Session lifecycle exceptions. For typical single step actions, + /// there are various convenience methods (Find, Load, SaveOrUpdate, Delete). + ///

+ /// + ///

Can be used within a service implementation via direct instantiation + /// with a ISessionFactory reference, or get prepared in an application context + /// and given to services as an object reference. Note: The ISessionFactory should + /// always be configured as an object in the application context, in the first case + /// given to the service directly, in the second case to the prepared template. + ///

+ /// + ///

This class can be considered as direct alternative to working with the raw + /// Hibernate Session API (through SessionFactoryUtils.Session). + ///

+ /// + ///

LocalSessionFactoryObject is the preferred way of obtaining a reference + /// to a specific NHibernate ISessionFactory. + ///

+ ///
+ /// Mark Pollack (.NET) + public class HibernateTemplate : HibernateAccessor, IHibernateOperations + { + #region Fields + + /// + /// The instance for this class. + /// + private readonly ILog log = LogManager.GetLogger(typeof(HibernateTemplate)); + + private bool checkWriteOperations = true; + + + private bool exposeNativeSession = false; + + private bool alwaysUseNewSession = false; + private int maxResults = 0; + private TemplateFlushMode templateFlushMode = TemplateFlushMode.Auto; + private bool allowCreate = true; + private ISessionFactory sessionFactory; + private object entityInterceptor; + private IObjectFactory objectFactory; + private bool cacheQueries = false; + private string queryCacheRegion; + private int fetchSize = 0; + + private IAdoExceptionTranslator adoExceptionTranslator; + + private readonly object syncRoot = new object(); + private ProxyFactory sessionProxyFactory; + + #endregion + + #region Constructor (s) + /// + /// Initializes a new instance of the class. + /// + public HibernateTemplate() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The default for creating a new non-transactional + /// session when no transactional Session can be found for the current thread + /// is set to true. + /// The session factory to create sessions. + public HibernateTemplate(ISessionFactory sessionFactory) + { + SessionFactory = sessionFactory; + AfterPropertiesSet(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The session factory to create sessions. + /// if set to true allow creation + /// of a new non-transactional when no transactional Session can be found + /// for the current thread. + public HibernateTemplate(ISessionFactory sessionFactory, bool allowCreate) + { + SessionFactory = sessionFactory; + AllowCreate = allowCreate; + AfterPropertiesSet(); + } + #endregion + + #region Properties + + /// + /// Gets or sets if a new Session should be created when no transactional Session + /// can be found for the current thread. + /// + /// + /// true if allowed to create non-transaction session; + /// otherwise, false. + /// + /// + ///

HibernateTemplate is aware of a corresponding Session bound to the + /// current thread, for example when using HibernateTransactionManager. + /// If allowCreate is true, a new non-transactional Session will be created + /// if none found, which needs to be closed at the end of the operation. + /// If false, an InvalidOperationException will get thrown in this case. + ///

+ ///
+ public override bool AllowCreate + { + get + { + + return allowCreate; + } + set { allowCreate = value; } + } + + /// + /// Gets or sets a value indicating whether to always + /// use a new Hibernate Session for this template. + /// + /// true if always use new session; otherwise, false. + /// + ///

+ /// Default is "false"; if activated, all operations on this template will + /// work on a new NHibernate ISession even in case of a pre-bound ISession + /// (for example, within a transaction). + ///

+ ///

Within a transaction, a new NHibernate ISession used by this template + /// will participate in the transaction through using the same ADO.NET + /// Connection. In such a scenario, multiple Sessions will participate + /// in the same database transaction. + ///

+ ///

Turn this on for operations that are supposed to always execute + /// independently, without side effects caused by a shared NHibernate ISession. + ///

+ ///
+ public override bool AlwaysUseNewSession + { + get { return alwaysUseNewSession; } + set { alwaysUseNewSession = value; } + } + + + /// + /// Gets or sets the template flush mode. + /// + /// + /// Default is Auto. Will get applied to any new ISession + /// created by the template. + /// + /// The template flush mode. + public override TemplateFlushMode TemplateFlushMode + { + get { return templateFlushMode; } + set { templateFlushMode = value; } + } + + /// + /// Gets or sets the entity interceptor that allows to inspect and change + /// property values before writing to and reading from the database. + /// + /// + /// Will get applied to any new ISession created by this object. + ///

Such an interceptor can either be set at the ISessionFactory level, + /// i.e. on LocalSessionFactoryObject, or at the ISession level, i.e. on + /// HibernateTemplate, HibernateInterceptor, and HibernateTransactionManager. + /// It's preferable to set it on LocalSessionFactoryObject or HibernateTransactionManager + /// to avoid repeated configuration and guarantee consistent behavior in transactions. + ///

+ ///
+ /// The interceptor. + /// If object factory is not set and need to retrieve entity interceptor by name. + public override IInterceptor EntityInterceptor + { + get + { + if (this.entityInterceptor is string) + { + if (this.objectFactory == null) + { + throw new InvalidOperationException("Cannot get entity interceptor via object name if no object factory set"); + } + return (IInterceptor)this.objectFactory.GetObject((String)this.entityInterceptor, typeof(IInterceptor)); + } + + return (IInterceptor)entityInterceptor; + } + set + { + entityInterceptor = value; + } + } + /// + /// Gets or sets the name of the cache region for queries executed by this template. + /// + /// + /// If this is specified, it will be applied to all IQuery and ICriteria objects + /// created by this template (including all queries through find methods). + ///

The cache region will not take effect unless queries created by this + /// template are configured to be cached via the CacheQueries property. + ///

+ ///
+ /// The query cache region. + public override string QueryCacheRegion + { + get { return queryCacheRegion; } + set { queryCacheRegion = value; } + } + + + /// + /// Gets or sets a value indicating whether to + /// cache all queries executed by this template. + /// + /// + /// If this is true, all IQuery and ICriteria objects created by + /// this template will be marked as cacheable (including all + /// queries through find methods). + ///

To specify the query region to be used for queries cached + /// by this template, set the QueryCacheRegion property. + ///

+ ///
+ /// true if cache queries; otherwise, false. + public override bool CacheQueries + { + get { return cacheQueries; } + set { cacheQueries = value; } + } + + /// + /// Gets or sets the maximum number of rows for this HibernateTemplate. + /// + /// The max results. + /// + /// This is important + /// for processing subsets of large result sets, avoiding to read and hold + /// the entire result set in the database or in the ADO.NET driver if we're + /// never interested in the entire result in the first place (for example, + /// when performing searches that might return a large number of matches). + ///

Default is 0, indicating to use the driver's default.

+ ///
+ public override int MaxResults + { + get { return maxResults; } + set { maxResults = value; } + } + + /// + /// Set whether to expose the native Hibernate Session to IHibernateCallback + /// code. Default is "false": a Session proxy will be returned, + /// suppressing close calls and automatically applying + /// query cache settings and transaction timeouts. + /// + /// true if expose native session; otherwise, false. + public override bool ExposeNativeSession + { + get { return exposeNativeSession; } + set { exposeNativeSession = value; } + } + /// + /// Gets or sets whether to check that the Hibernate Session is not in read-only mode + /// in case of write operations (save/update/delete). + /// + /// + /// true if check that the Hibernate Session is not in read-only mode + /// in case of write operations; otherwise, false. + /// + /// + /// Default is "true", for fail-fast behavior when attempting write operations + /// within a read-only transaction. Turn this off to allow save/update/delete + /// on a Session with flush mode NEVER. + /// + public virtual bool CheckWriteOperations + { + get { return checkWriteOperations; } + set { checkWriteOperations = value; } + } + + /// + /// Set the object name of a Hibernate entity interceptor that allows to inspect + /// and change property values before writing to and reading from the database. + /// + /// + /// Will get applied to any new Session created by this transaction manager. + ///

Requires the object factory to be known, to be able to resolve the object + /// name to an interceptor instance on session creation. Typically used for + /// prototype interceptors, i.e. a new interceptor instance per session. + ///

+ ///

Can also be used for shared interceptor instances, but it is recommended + /// to set the interceptor reference directly in such a scenario. + ///

+ ///
+ /// The name of the entity interceptor in the object factory/application context. + public override string EntityInterceptorObjectName + { + set + { + this.entityInterceptor = value; + } + } + + /// + /// Set the object factory instance. + /// + /// The object factory instance + public override IObjectFactory ObjectFactory + { + set + { + objectFactory = value; + } + } + + /// + /// Gets or sets the session factory that should be used to create + /// NHibernate ISessions. + /// + /// The session factory. + public override ISessionFactory SessionFactory + { + get { return sessionFactory; } + set + { + sessionFactory = value; + } + } + + /// + /// Gets or sets the fetch size for this HibernateTemplate. + /// + /// The size of the fetch. + /// This is important for processing + /// large result sets: Setting this higher than the default value will increase + /// processing speed at the cost of memory consumption; setting this lower can + /// avoid transferring row data that will never be read by the application. + ///

Default is 0, indicating to use the driver's default.

+ ///
+ public override int FetchSize + { + get { return fetchSize; } + set { fetchSize = value; } + } + + + /// + /// Gets or sets the proxy factory. + /// + /// This may be useful to set if you create many instances of + /// HibernateTemplate and/or HibernateDaoSupport. This allows the same + /// ProxyFactory implementation to be used thereby limiting the + /// number of dynamic proxy types created in the temporary assembly, which + /// are never garbage collected due to .NET runtime semantics. + /// + /// The proxy factory. + public virtual ProxyFactory ProxyFactory + { + get { return sessionProxyFactory; } + set { sessionProxyFactory = value; } + } + + #endregion + + #region IHibernateOperations Members + + /// + /// Set the ADO.NET exception translator for this instance. + /// Applied to System.Data.Common.DbException (or provider specific exception type + /// in .NET 1.1) thrown by callback code, be it direct + /// DbException or wrapped Hibernate ADOExceptions. + ///

The default exception translator is either a ErrorCodeExceptionTranslator + /// if a DbProvider is available, or a FalbackExceptionTranslator otherwise + ///

+ ///
+ /// The ADO exception translator. + public override IAdoExceptionTranslator AdoExceptionTranslator + { + set { adoExceptionTranslator = value; } + get + { + if (adoExceptionTranslator == null) + { + adoExceptionTranslator = SessionFactoryUtils.NewAdoExceptionTranslator(SessionFactory); + } + return adoExceptionTranslator; + } + } + + + /// + /// Delegate function that clears the session. + /// + /// The hibernate session. + /// null + protected object ClearAction(ISession session) + { + session.Clear(); + return null; + } + + /// + /// Flush all pending saves, updates and deletes to the database. + /// + /// + /// Only invoke this for selective eager flushing, for example when ADO.NET code + /// needs to see certain changes within the same transaction. Else, it's preferable + /// to rely on auto-flushing at transaction completion. + /// + /// In case of Hibernate errors + public void Flush() + { + Execute(new HibernateDelegate(FlushAction), true); + } + + private object FlushAction(ISession session) + { + session.Flush(); + return null; + } + + /// + /// Return the persistent instance of the given entity type + /// with the given identifier, or null if not found. + /// + /// The type. + /// An identifier of the persistent instance. + /// The persistent instance, or null if not found + /// In case of Hibernate errors + public object Get(Type entityType, object id) + { + return Get(entityType, id, null); + } + + /// + /// Return the persistent instance of the given entity type + /// with the given identifier, or null if not found. + /// Obtains the specified lock mode if the instance exists. + /// + /// The type. + /// The lock mode to obtain. + /// The lock mode. + /// the persistent instance, or null if not found + /// the persistent instance, or null if not found + /// In case of Hibernate errors + public object Get(Type type, object id, LockMode lockMode) + { + return Execute(new GetByTypeHibernateCallback(type, id, lockMode),true); + + } + + /// + /// Return the persistent instance of the given entity class + /// with the given identifier, throwing an exception if not found. + /// + /// Type of the entity. + /// An identifier of the persistent instance. + /// The persistent instance + /// If not found + /// In case of Hibernate errors + public object Load(Type entityType, object id) + { + return Load(entityType, id, null); + } + + /// + /// Return the persistent instance of the given entity class + /// with the given identifier, throwing an exception if not found. + /// Obtains the specified lock mode if the instance exists. + /// + /// Type of the entity. + /// An identifier of the persistent instance. + /// The lock mode. + /// The persistent instance + /// If not found + /// In case of Hibernate errors + public object Load(Type entityType, object id, LockMode lockMode) + { + return Execute(new LoadByTypeHibernateCallback(entityType, id, lockMode),true); + + } + + /// + /// Load the persistent instance with the given identifier + /// into the given object, throwing an exception if not found. + /// + /// Entity the object (of the target class) to load into. + /// An identifier of the persistent instance. + /// If object not found. + /// In case of Hibernate errors + public void Load(object entity, object id) + { + Execute(new LoadByEntityHibernateCallback(entity, id),true); + } + + /// + /// Return all persistent instances of the given entity class. + /// Note: Use queries or criteria for retrieving a specific subset. + /// + /// Type of the entity. + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList LoadAll(Type entityType) + { + return (IList)Execute(new LoadAllByTypeHibernateCallback(this, entityType),true); + } + + /// + /// Re-read the state of the given persistent instance. + /// + /// The persistent instance to re-read. + /// In case of Hibernate errors + public void Refresh(object entity) + { + Refresh(entity, null); + } + + /// + /// Re-read the state of the given persistent instance. + /// Obtains the specified lock mode for the instance. + /// + /// The persistent instance to re-read. + /// The lock mode to obtain. + /// In case of Hibernate errors + public void Refresh(object entity, LockMode lockMode) + { + Execute(new RefreshHibernateCallback(entity, lockMode),true); + } + + /// + /// Obtain the specified lock level upon the given object, implicitly + /// checking whether the corresponding database entry still exists + /// (throwing an OptimisticLockingFailureException if not found). + /// + /// The he persistent instance to lock. + /// The lock mode to obtain. + /// If not found + /// In case of Hibernate errors + public void Lock(object entity, LockMode lockMode) + { + Execute(new LockHibernateCallback(entity, lockMode),true); + } + + /// + /// Persist the given transient instance. + /// + /// The transient instance to persist. + /// The generated identifier. + /// In case of Hibernate errors + public object Save(object entity) + { + return Execute(new SaveObjectHibernateCallback(this, entity),true); + } + + /// + /// Persist the given transient instance with the given identifier. + /// + /// The transient instance to persist. + /// The identifier to assign. + /// In case of Hibernate errors + public void Save(object entity, object id) + { + Execute(new SaveObjectWithIdHibernateCallback(this, entity, id),true); + } + + /// + /// Update the given persistent instance. + /// + /// The persistent instance to update. + /// In case of Hibernate errors + public void Update(object entity) + { + Update(entity, null); + } + + /// + /// Update the given persistent instance. + /// Obtains the specified lock mode if the instance exists, implicitly + /// checking whether the corresponding database entry still exists + /// (throwing an OptimisticLockingFailureException if not found). + /// + /// The persistent instance to update. + /// The lock mode to obtain. + /// In case of Hibernate errors + public void Update(object entity, LockMode lockMode) + { + Execute(new UpdateObjectHibernateCallback(this, entity, lockMode),true); + } + + /// + /// Save or update the given persistent instance, + /// according to its id (matching the configured "unsaved-value"?). + /// + /// Tthe persistent instance to save or update + /// (to be associated with the Hibernate Session). + /// In case of Hibernate errors + public void SaveOrUpdate(object entity) + { + Execute(new SaveOrUpdateObjectHibernateCallback(this, entity),true); + } + + /// + /// Save or update all given persistent instances, + /// according to its id (matching the configured "unsaved-value"?). + /// + /// Tthe persistent instances to save or update + /// (to be associated with the Hibernate Session)he entities. + /// In case of Hibernate errors + public void SaveOrUpdateAll(ICollection entities) + { + Execute(new SaveOrUpdateAllHibernateCallback(this, entities), true); + } + + /// + /// Save or update the contents of given persistent object, + /// according to its id (matching the configured "unsaved-value"?). + /// Will copy the contained fields to an already loaded instance + /// with the same id, if appropriate. + /// + /// The persistent object to save or update. + /// (not necessarily to be associated with the Hibernate Session) + /// + /// The actually associated persistent object. + /// (either an already loaded instance with the same id, or the given object) + /// In case of Hibernate errors + public object SaveOrUpdateCopy(object entity) + { + return Execute(new SaveOrUpdateCopyHibernateCallback(this, entity),true); } #if !NH_1_2 @@ -697,1557 +697,1560 @@ namespace Spring.Data.NHibernate public object Merge(object entity) { return Execute(new MergeHibernateCallback(this, entity), true); - } -#endif - - /// - /// Remove all objects from the Session cache, and cancel all pending saves, - /// updates and deletes. - /// - public void Clear() - { - Execute(new HibernateDelegate(ClearAction), true); - } - - - - /// - /// Determines whether the given object is in the Session cache. - /// - /// the persistence instance to check. - /// - /// true if session cache contains the specified entity; otherwise, false. - /// - /// In case of Hibernate errors - public bool Contains(object entity) - { - return (bool)Execute(new ContainsHibernateCallback(entity)); - } - - /// - /// Remove the given object from the Session cache. - /// - /// The persistent instance to evict. - /// In case of Hibernate errors - public void Evict(object entity) - { - Execute(new EvictHibernateCallback(entity), true); - - } - - - - /// - /// Delete the given persistent instance. - /// - /// The persistent instance to delete. - /// In case of Hibernate errors - public void Delete(object entity) - { - Delete(entity, null); - } - - - /// - /// Delete the given persistent instance. - /// - /// Tthe persistent instance to delete. - /// The lock mode to obtain. - /// - /// Obtains the specified lock mode if the instance exists, implicitly - /// checking whether the corresponding database entry still exists - /// (throwing an OptimisticLockingFailureException if not found). - /// - /// In case of Hibernate errors - public void Delete(object entity, LockMode lockMode) - { - Execute(new DeleteLockModeHibernateCallback(this, entity, lockMode), true); - } - - /// - /// Delete all objects returned by the query. - /// - /// a query expressed in Hibernate's query language. - /// The number of entity instances deleted. - /// In case of Hibernate errors - public int Delete(string queryString) - { - return Delete(queryString, (Object[]) null, (IType[]) null); - } - - /// - /// Delete all objects returned by the query. - /// - /// a query expressed in Hibernate's query language. - /// The value of the parameter. - /// The Hibernate type of the parameter (or null). - /// The number of entity instances deleted. - /// In case of Hibernate errors - public int Delete(string queryString, object value, IType type) - { - return Delete(queryString, new Object[] {value}, new IType[] {type}); - } - - /// - /// Delete all objects returned by the query. - /// - /// a query expressed in Hibernate's query language. - /// The values of the parameters. - /// Hibernate types of the parameters (or null) - /// The number of entity instances deleted. - /// In case of Hibernate errors - /// If length for argument values and types are not equal. - public int Delete(String queryString, Object[] values, IType[] types) - { - if (values != null && types != null && values.Length != types.Length) - { - throw new ArgumentOutOfRangeException("values", "Length of values array must match length of types array"); - } - return (int)Execute(new DeletebyQueryHibernateCallback(this, queryString, values, types),true); - - } - - - /// - /// Delete all given persistent instances. - /// - /// The persistent instances to delete. - /// - /// This can be combined with any of the find methods to delete by query - /// in two lines of code, similar to Session's delete by query methods. - /// - /// In case of Hibernate errors - public void DeleteAll(ICollection entities) - { - Execute(new DeleteAllHibernateCallback(this, entities),true); - } - - - /// - /// Execute the action specified by the given action object within a Session. - /// - /// - /// Application exceptions thrown by the action object get propagated to the - /// caller (can only be unchecked). Hibernate exceptions are transformed into - /// appropriate DAO ones. Allows for returning a result object, i.e. a domain - /// object or a collection of domain objects. - ///

Note: Callback code is not supposed to handle transactions itself! - /// Use an appropriate transaction manager like HibernateTransactionManager. - /// Generally, callback code must not touch any Session lifecycle methods, - /// like close, disconnect, or reconnect, to let the template do its work. - ///

- ///
- /// The delegate callback object that specifies the Hibernate action. - /// a result object returned by the action, or null - /// - /// In case of Hibernate errors - public object Execute(HibernateDelegate del) - { - return Execute(new ExecuteHibernateCallbackUsingDelegate(del)); - } - - /// - /// Execute the action specified by the delegate within a Session. - /// - /// The HibernateDelegate that specifies the action - /// to perform. - /// if set to true expose the native hibernate session to - /// callback code. - /// a result object returned by the action, or null - /// - public object Execute(HibernateDelegate del, bool exposeNativeSession) - { - return Execute(new ExecuteHibernateCallbackUsingDelegate(del), true); - } - - /// - /// Execute the action specified by the given action object within a Session. - /// - /// The callback object that specifies the Hibernate action. - /// - /// a result object returned by the action, or null - /// - /// - /// Application exceptions thrown by the action object get propagated to the - /// caller (can only be unchecked). Hibernate exceptions are transformed into - /// appropriate DAO ones. Allows for returning a result object, i.e. a domain - /// object or a collection of domain objects. - ///

Note: Callback code is not supposed to handle transactions itself! - /// Use an appropriate transaction manager like HibernateTransactionManager. - /// Generally, callback code must not touch any Session lifecycle methods, - /// like close, disconnect, or reconnect, to let the template do its work. - ///

- ///
- /// In case of Hibernate errors - public object Execute(IHibernateCallback action) - { - return Execute(action, ExposeNativeSession); - } - - /// - /// Execute the specified action assuming that the result object is a List. - /// - /// - /// This is a convenience method for executing Hibernate find calls or - /// queries within an action. - /// - /// The calback object that specifies the Hibernate action. - /// A IList returned by the action, or null - /// - /// In case of Hibernate errors - public IList ExecuteFind(IHibernateCallback action) - { - Object result = Execute(action, ExposeNativeSession); - if (result != null && !(result is IList)) { - throw new InvalidDataAccessApiUsageException( - "Result object returned from HibernateCallback isn't a List: [" + result + "]"); - } - return (IList) result; - } - - /// - /// Execute the action specified by the given action object within a Session. - /// - /// callback object that specifies the Hibernate action. - /// if set to true expose the native hibernate session to - /// callback code. - /// - /// a result object returned by the action, or null - /// - public object Execute(IHibernateCallback action, bool exposeNativeSession) - { - ISession session = Session; - - bool existingTransaction = SessionFactoryUtils.IsSessionTransactional(session, SessionFactory); - if (existingTransaction) - { - if(log.IsDebugEnabled) log.Debug("Found thread-bound Session for HibernateTemplate"); - } - - FlushModeHolder previousFlushModeHolder = new FlushModeHolder(); - try - { - previousFlushModeHolder = ApplyFlushMode(session, existingTransaction); - ISession sessionToExpose = (exposeNativeSession ? session : CreateSessionProxy(session)); - Object result = action.DoInHibernate(sessionToExpose); - FlushIfNecessary(session, existingTransaction); - return result; - } - catch (ADOException ex) - { - IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(SessionFactory); - if (dbProvider != null && dbProvider.IsDataAccessException(ex.InnerException)) - { - throw ConvertAdoAccessException(ex); - } - else - { - throw new HibernateSystemException(ex); - } - } - catch (HibernateException ex) - { - throw ConvertHibernateAccessException(ex); - } - catch (Exception ex) - { - IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(SessionFactory); - if (dbProvider != null && dbProvider.IsDataAccessException(ex)) - { - throw ConvertAdoAccessException(ex); - } - else - { - // Callback code throw application exception or other non DB related exception. - throw; - } - } - finally - { - if (existingTransaction) - { - if (log.IsDebugEnabled) log.Debug("Not closing pre-bound Hibernate Session after HibernateTemplate"); - if (previousFlushModeHolder.ModeWasSet) - { - session.FlushMode = previousFlushModeHolder.Mode; - } - } - else - { - // Never use deferred close for an explicitly new Session. - if (AlwaysUseNewSession) - { - SessionFactoryUtils.CloseSession(session); - } - else - { - SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, SessionFactory); - } - } - } - } - - /// - /// Execute a query for persistent instances. - /// - /// a query expressed in Hibernate's query language - /// - /// a List containing 0 or more persistent instances - /// - /// In case of Hibernate errors - public IList Find(string queryString) - { - return Find(queryString, (object[])null, (IType[])null ); - } - - /// - /// Execute a query for persistent instances, binding - /// one value to a "?" parameter in the query string. - /// - /// a query expressed in Hibernate's query language - /// the value of the parameter - /// - /// a List containing 0 or more persistent instances - /// - /// In case of Hibernate errors - public IList Find(string queryString, object value) - { - return Find(queryString, new object[] {value}, (IType[]) null); - } - - /// - /// Execute a query for persistent instances, binding one value - /// to a "?" parameter of the given type in the query string. - /// - /// a query expressed in Hibernate's query language - /// The value of the parameter. - /// Hibernate type of the parameter (or null) - /// - /// a List containing 0 or more persistent instances - /// - /// In case of Hibernate errors - public IList Find(string queryString, object value, IType type) - { - return Find(queryString, new object[] {value}, new IType[] {type}); - } - - /// - /// Execute a query for persistent instances, binding a - /// number of values to "?" parameters in the query string. - /// - /// a query expressed in Hibernate's query language - /// the values of the parameters - /// a List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList Find(string queryString, object[] values) - { - return Find(queryString, values, (IType[]) null); - } - - /// - /// Execute a query for persistent instances, binding a number of - /// values to "?" parameters of the given types in the query string. - /// - /// A query expressed in Hibernate's query language - /// The values of the parameters - /// Hibernate types of the parameters (or null) - /// - /// a List containing 0 or more persistent instances - /// - /// In case of Hibernate errors - /// If values and types are not null and their lengths are not equal - public IList Find(string queryString, object[] values, IType[] types) - { - if (values != null && types != null && values.Length != types.Length) - { - throw new ArgumentException("Length of values array must match length of types array"); - } - return (IList)Execute(new FindHibernateCallback(this, queryString, values, types),true); - } - - /// - /// Execute a query for persistent instances, binding - /// one value to a named parameter in the query string. - /// - /// The name of a Hibernate query in a mapping file - /// The name of the parameter - /// The value of the parameter - /// a List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedParam(string queryName, string paramName, object value) - { - return FindByNamedParam(queryName, paramName, value, null); - } - - /// - /// Execute a query for persistent instances, binding - /// one value to a named parameter in the query string. - /// - /// The name of a Hibernate query in a mapping file - /// The name of the parameter - /// The value of the parameter - /// Hibernate type of the parameter (or null) - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedParam(string queryName, string paramName, object value, IType type) - { - return FindByNamedParam(queryName, new string[] {paramName}, new object[] {value}, new IType[] {type}); - } - - /// - /// Execute a query for persistent instances, binding a - /// number of values to named parameters in the query string. - /// - /// A query expressed in Hibernate's query language - /// The names of the parameters - /// The values of the parameters - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedParam(string queryString, string[] paramNames, object[] values) - { - return FindByNamedParam(queryString, paramNames, values, null); - } - - /// - /// Execute a query for persistent instances, binding a - /// number of values to named parameters in the query string. - /// - /// A query expressed in Hibernate's query language - /// The names of the parameters - /// The values of the parameters - /// Hibernate types of the parameters (or null) - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - /// If paramNames length is not equal to values length or - /// if paramNames length is not equal to types length (when types is not null) - public IList FindByNamedParam(string queryString, string[] paramNames, object[] values, IType[] types) - { - if (paramNames.Length != values.Length) - { - throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of values array"); - } - if (types != null && paramNames.Length != types.Length) - { - throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of types array"); - } - - return (IList)Execute(new FindByNamedParamHibernateCallback(this, queryString, paramNames, values, types),true); - - } - - /// - /// Execute a named query for persistent instances. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQuery(string queryName) - { - return FindByNamedQuery(queryName, (object[]) null, (IType[]) null); - } - - /// - /// Execute a named query for persistent instances, binding - /// one value to a "?" parameter in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The value of the parameter - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQuery(string queryName, object value) - { - return FindByNamedQuery(queryName, new object[] {value}, (IType[]) null); - } - - /// - /// Execute a named query for persistent instances, binding - /// one value to a "?" parameter in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The value of the parameter - /// Hibernate type of the parameter (or null) - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQuery(string queryName, object value, IType type) - { - return FindByNamedQuery(queryName, new object[] { value }, new IType[] { type }); - } - - /// - /// Execute a named query for persistent instances, binding a - /// number of values to "?" parameters in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The values of the parameters - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQuery(string queryName, object[] values) - { - return FindByNamedQuery(queryName, values, (IType[]) null); - } - - /// - /// Execute a named query for persistent instances, binding a - /// number of values to "?" parameters in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The values of the parameters - /// Hibernate types of the parameters (or null) - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - /// If values and types are not null and their lengths differ. - public IList FindByNamedQuery(string queryName, object[] values, IType[] types) - { - if (values != null && types != null && values.Length != types.Length) - { - throw new ArgumentOutOfRangeException("Length of values array must match length of types array"); - } - return (IList)Execute(new FindByNamedQueryHibernateCallback(this, queryName, values, types),true); - - - } - - /// - /// Execute a named query for persistent instances, binding - /// one value to a named parameter in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// Name of the parameter - /// The value of the parameter - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value) - { - return FindByNamedQueryAndNamedParam(queryName, paramName, value, null); - - } - - /// - /// Execute a named query for persistent instances, binding - /// one value to a named parameter in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// Name of the parameter - /// The value of the parameter - /// The Hibernate type of the parameter (or null) - /// A List containing 0 or more persistent instances - public IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value, IType type) - { - return FindByNamedQueryAndNamedParam( - queryName, new string[] {paramName}, new object[] {value}, new IType[] {type}); - - } - - /// - /// Execute a named query for persistent instances, binding - /// number of values to named parameters in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The names of the parameters - /// The values of the parameters. - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values) - { - return FindByNamedQueryAndNamedParam(queryName, paramNames, values, null); - - } - - /// - /// Execute a named query for persistent instances, binding - /// number of values to named parameters in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The names of the parameters - /// The values of the parameters. - /// Hibernate types of the parameters (or null) - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - /// If paramNames length is not equal to values length or - /// if paramNames length is not equal to types length (when types is not null) - public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values, IType[] types) - { - if (paramNames != null && values != null && paramNames.Length != values.Length) - { - throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of values array"); - } - if (paramNames != null && types != null && paramNames.Length != types.Length) - { - throw new ArgumentOutOfRangeException("paramNams","Length of paramNames array must match length of types array"); - } - return (IList)Execute(new FindByNamedQueryAndNamedParamHibernateCallback(this, queryName, paramNames, values, types),true); - - } - - /// - /// Execute a named query for persistent instances, binding the properties - /// of the given object to named parameters in the query string. - /// A named query is defined in a Hibernate mapping file. - /// - /// The name of a Hibernate query in a mapping file - /// The values of the parameters - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByNamedQueryAndValueObject(string queryName, object valueObject) - { - return (IList)Execute(new FindByNamedQueryAndValueObjectHibernateCallback(this, queryName, valueObject),true); - - } - - /// - /// Execute a query for persistent instances, binding the properties - /// of the given object to named parameters in the query string. - /// - /// A query expressed in Hibernate's query language - /// The values of the parameters - /// A List containing 0 or more persistent instances - /// In case of Hibernate errors - public IList FindByValueObject(string queryString, object valueObject) - { - return (IList)Execute(new FindByValueObjectHibernateCallback(this, queryString, valueObject), true); - } - - #endregion - - #region Methods - - - /// - /// Create a close-suppressing proxy for the given Hibernate Session. - /// The proxy also prepares returned Query and Criteria objects. - /// - /// The session. - /// The session proxy. - public virtual ISession CreateSessionProxy(ISession session) - { - //TODO can move to HibernateAccessor and make protected - // if issue reported with AOP+Multiple Threads resolve. - // have not been able to reproduce so added lock as a precaution. - // - lock (syncRoot) - { - if (sessionProxyFactory == null) - { - sessionProxyFactory = new ProxyFactory(); - sessionProxyFactory.AddAdvice(new CloseSuppressingMethodInterceptor(this)); - } - - sessionProxyFactory.Target = session; - - return (ISession)sessionProxyFactory.GetProxy(); - } - } - - /// - /// Check whether write operations are allowed on the given Session. - /// - /// - /// Default implementation throws an InvalidDataAccessApiUsageException - /// in case of FlushMode.Never. Can be overridden in subclasses. - /// - /// The current Hibernate session. - /// If write operation is attempted in read-only mode - /// - public virtual void CheckWriteOperationAllowed(ISession session) - { - if (CheckWriteOperations && TemplateFlushMode != TemplateFlushMode.Eager && - AreEqualFlushMode(TemplateFlushMode.Never, session.FlushMode)) - { - throw new InvalidDataAccessApiUsageException( - "Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session " + - "into FlushMode.AUTO or remove 'readOnly' marker from transaction definition"); - } - } - - - - /// - /// Compares if the flush mode enumerations, Spring's - /// TemplateFlushMode and NHibernates FlushMode have equal - /// settings. - /// - /// The template flush mode. - /// The NHibernate flush mode. - /// - /// Returns true if both are Never, Auto, or Commit, false - /// otherwise. - /// - protected bool AreEqualFlushMode(TemplateFlushMode tfm, FlushMode fm) - { - if ( (tfm ==TemplateFlushMode.Never && fm == FlushMode.Never) || - (tfm ==TemplateFlushMode.Auto && fm == FlushMode.Auto) || - (tfm ==TemplateFlushMode.Commit && fm == FlushMode.Commit) ) - { - return true; - } - else - { - return false; - } - //TODO other combinations. - } - - #endregion - } - - #region Internal Supporting Callback Classes - - //TODO see if can create common base class for some callbacks. - - internal class ContainsHibernateCallback : IHibernateCallback - { - private object entity; - public ContainsHibernateCallback(object entity) - { - this.entity = entity; - } - - public object DoInHibernate(ISession session) - { - return session.Contains(entity); - } - } - - - internal class DeleteLockModeHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private object entity; - private LockMode lockMode; - public DeleteLockModeHibernateCallback(HibernateTemplate template, object entity, LockMode lockMode) - { - this.outer = template; - this.entity = entity; - this.lockMode = lockMode; - } - - public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - if (lockMode != null) - { - session.Lock(entity, lockMode); - } - session.Delete(entity); - return null; - } - } - - - internal class DeletebyQueryHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private string queryString; - private object[] values; - private IType[] types; - - public DeletebyQueryHibernateCallback(HibernateTemplate template, string queryString, object[] values, IType[] types) - { - this.outer = template; - this.queryString = queryString; - this.values = values; - this.types = types; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - if (values != null) - { - return session.Delete(queryString, values, types); - } - else - { - return session.Delete(queryString); - } - } - } - - - - internal class DeleteAllHibernateCallback : IHibernateCallback - { - HibernateTemplate outer; - private ICollection entities; - - public DeleteAllHibernateCallback(HibernateTemplate template, ICollection entities) - { - this.outer = template; - this.entities = entities; - - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - foreach (object entity in entities) - { - session.Delete(entity); - } - return null; - } - - - - } - - - internal class EvictHibernateCallback : IHibernateCallback - { - private object entity; - - public EvictHibernateCallback(object entity) - { - this.entity = entity; - - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - session.Evict(entity); - return null; - } - - - - } - - - internal class FindHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private string queryString; - private object[] values; - private IType[] types; - - public FindHibernateCallback(HibernateTemplate template, string queryString, object[] values, IType[] types) - { - this.outer = template; - this.queryString = queryString; - this.values = values; - this.types = types; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - IQuery queryObject = session.CreateQuery(queryString); - outer.PrepareQuery(queryObject); - if (values != null) - { - for (int i = 0; i < values.Length; i++) - { - if (types != null && types[i] != null) - { - queryObject.SetParameter(i, values[i], types[i]); - } - else - { - queryObject.SetParameter(i, values[i]); - } - } - } - - return queryObject.List(); - } - } - - - internal class FindByNamedParamHibernateCallback : IHibernateCallback - { - HibernateTemplate outer; - private string queryString; - private string[] paramNames; - private object[] values; - private IType[] types; - - public FindByNamedParamHibernateCallback(HibernateTemplate template, string queryString, string[] paramNames, object[] values, IType[] types) - { - this.outer = template; - this.queryString = queryString; - this.paramNames = paramNames; - this.values = values; - this.types = types; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - IQuery queryObject = session.CreateQuery(queryString); - outer.PrepareQuery(queryObject); - if (values != null) - { - for (int i = 0; i < values.Length; i++) - { - outer.ApplyNamedParameterToQuery(queryObject, paramNames[i], values[i], (types != null ? types[i] : null)); - } - } - return queryObject.List(); - - } - } - - - internal class FindByNamedQueryHibernateCallback : IHibernateCallback - { - HibernateTemplate outer; - private string queryName; - private object[] values; - private IType[] types; - - public FindByNamedQueryHibernateCallback(HibernateTemplate template, string queryName, object[] values, IType[] types) - { - this.outer = template; - this.queryName = queryName; - this.values = values; - this.types = types; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - IQuery queryObject = session.GetNamedQuery(queryName); - outer.PrepareQuery(queryObject); - if (values != null) - { - for (int i = 0; i < values.Length; i++) - { - if (types != null && types[i] != null) - { - queryObject.SetParameter(i, values[i], types[i]); - } - else - { - queryObject.SetParameter(i, values[i]); - } - } - } - return queryObject.List(); - - } - } - - - internal class FindByNamedQueryAndNamedParamHibernateCallback : IHibernateCallback - { - HibernateTemplate outer; - private string queryName; - private string[] paramNames; - private object[] values; - private IType[] types; - - public FindByNamedQueryAndNamedParamHibernateCallback(HibernateTemplate template, string queryName, string[] paramNames, object[] values, IType[] types) - { - this.outer = template; - this.queryName = queryName; - this.paramNames = paramNames; - this.values = values; - this.types = types; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - IQuery queryObject = session.GetNamedQuery(queryName); - outer.PrepareQuery(queryObject); - if (values != null) - { - for (int i = 0; i < values.Length; i++) - { - outer.ApplyNamedParameterToQuery(queryObject, paramNames[i], values[i], (types != null ? types[i] : null)); - } - } - return queryObject.List(); - - } - } - - - internal class FindByNamedQueryAndValueObjectHibernateCallback : IHibernateCallback - { - HibernateTemplate outer; - private string queryName; - private object valueObject; - - public FindByNamedQueryAndValueObjectHibernateCallback(HibernateTemplate template, string queryName, object valueObject) - { - this.outer = template; - this.queryName = queryName; - this.valueObject = valueObject; - - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - IQuery queryObject = session.GetNamedQuery(queryName); - outer.PrepareQuery(queryObject); - queryObject.SetProperties(valueObject); - return queryObject.List(); - - } - - - - } - - internal class FindByValueObjectHibernateCallback : IHibernateCallback - { - HibernateTemplate outer; - private string queryString; - private object valueObject; - - public FindByValueObjectHibernateCallback(HibernateTemplate template, string queryString, object valueObject) - { - this.outer = template; - this.queryString = queryString; - this.valueObject = valueObject; - - } - - public object DoInHibernate(ISession session) - { - IQuery queryObject = session.CreateQuery(queryString); - outer.PrepareQuery(queryObject); - queryObject.SetProperties(valueObject); - return queryObject.List(); - - } - - } - - internal class ExecuteHibernateCallbackUsingDelegate : IHibernateCallback - { - private HibernateDelegate del; - - public ExecuteHibernateCallbackUsingDelegate(HibernateDelegate d) - { - del = d; - } - - public object DoInHibernate(ISession session) - { - return del(session); - } - } - - - internal class GetByTypeHibernateCallback : IHibernateCallback - { - private Type entityType; - private object id; - private LockMode lockMode; - - public GetByTypeHibernateCallback(Type entityType, object id, LockMode lockMode) - { - this.entityType = entityType; - this.id = id; - this.lockMode = lockMode; - - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - if (lockMode != null) - { - return session.Get(entityType, id, lockMode); - } - else - { - return session.Get(entityType, id); - } - } - - - - } - - - internal class LoadByTypeHibernateCallback : IHibernateCallback - { - private Type entityType; - private object id; - private LockMode lockMode; - - public LoadByTypeHibernateCallback(Type entityType, object id, LockMode lockMode) - { - this.entityType = entityType; - this.id = id; - this.lockMode = lockMode; - - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - if (lockMode != null) - { - return session.Load(entityType, id, lockMode); - } - else - { - return session.Load(entityType, id); - } - } - - - - } - - - internal class LoadByEntityHibernateCallback : IHibernateCallback - { - private object entity; - private object id; - - public LoadByEntityHibernateCallback(object entity, object id) - { - this.entity = entity; - this.id = id; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - session.Load(entity, id); - return null; - } - - - - } - - - internal class LoadAllByTypeHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private Type entityType; - - public LoadAllByTypeHibernateCallback(HibernateTemplate template, Type entityType) - { - outer = template; - this.entityType = entityType; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - ICriteria criteria = session.CreateCriteria(entityType); - outer.PrepareCriteria(criteria); - return criteria.List(); - } - } - - - internal class LockHibernateCallback : IHibernateCallback - { - private object entity; - private LockMode lockMode; - - public LockHibernateCallback(object entity, LockMode lockMode) - { - this.entity = entity; - this.lockMode = lockMode; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - session.Lock(entity, lockMode); - return null; - } - } - - - internal class RefreshHibernateCallback : IHibernateCallback - { - private object entity; - private LockMode lockMode; - - public RefreshHibernateCallback(object entity, LockMode lockMode) - { - this.entity = entity; - this.lockMode = lockMode; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - if (lockMode != null) - { - session.Refresh(entity, lockMode); - } - else - { - session.Refresh(entity); - } - return null; - } - } - - - internal class SaveObjectHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private object entity; - - public SaveObjectHibernateCallback(HibernateTemplate template, object entity) - { - this.outer = template; - this.entity = entity; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - return session.Save(entity); - } - } - - - internal class SaveObjectWithIdHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private object entity; - private object id; - - public SaveObjectWithIdHibernateCallback(HibernateTemplate template, object entity, object id) - { - this.outer = template; - this.entity = entity; - this.id = id; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - session.Save(entity, id); - return null; - } - } - - - internal class UpdateObjectHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private object entity; - private LockMode lockMode; - - public UpdateObjectHibernateCallback(HibernateTemplate template, object entity, LockMode lockMode) - { - this.outer = template; - this.entity = entity; - this.lockMode = lockMode; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - session.Update(entity); - if (lockMode != null) - { - session.Lock(entity, lockMode); - } - return null; - } - } - - - internal class SaveOrUpdateObjectHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private object entity; - - public SaveOrUpdateObjectHibernateCallback(HibernateTemplate template, object entity) - { - this.outer = template; - this.entity = entity; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - session.SaveOrUpdate(entity); - return null; - } - } - - internal class SaveOrUpdateAllHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private ICollection entities; - - public SaveOrUpdateAllHibernateCallback(HibernateTemplate template, ICollection entities) - { - this.outer = template; - this.entities = entities; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); - foreach (object entity in entities) - { - session.SaveOrUpdate(entity); - } - return null; - } - } - internal class SaveOrUpdateCopyHibernateCallback : IHibernateCallback - { - private HibernateTemplate outer; - private object entity; - - public SaveOrUpdateCopyHibernateCallback(HibernateTemplate template, object entity) - { - this.outer = template; - this.entity = entity; - } - - /// - /// Gets called by HibernateTemplate with an active - /// Hibernate Session. Does not need to care about activating or closing - /// the Session, or handling transactions. - /// - /// - ///

- /// Allows for returning a result object created within the callback, i.e. - /// a domain object or a collection of domain objects. Note that there's - /// special support for single step actions: see HibernateTemplate.find etc. - ///

- ///
- public object DoInHibernate(ISession session) - { - outer.CheckWriteOperationAllowed(session); + } +#endif + + /// + /// Remove all objects from the Session cache, and cancel all pending saves, + /// updates and deletes. + /// + public void Clear() + { + Execute(new HibernateDelegate(ClearAction), true); + } + + + + /// + /// Determines whether the given object is in the Session cache. + /// + /// the persistence instance to check. + /// + /// true if session cache contains the specified entity; otherwise, false. + /// + /// In case of Hibernate errors + public bool Contains(object entity) + { + return (bool)Execute(new ContainsHibernateCallback(entity)); + } + + /// + /// Remove the given object from the Session cache. + /// + /// The persistent instance to evict. + /// In case of Hibernate errors + public void Evict(object entity) + { + Execute(new EvictHibernateCallback(entity), true); + + } + + + + /// + /// Delete the given persistent instance. + /// + /// The persistent instance to delete. + /// In case of Hibernate errors + public void Delete(object entity) + { + Delete(entity, null); + } + + + /// + /// Delete the given persistent instance. + /// + /// Tthe persistent instance to delete. + /// The lock mode to obtain. + /// + /// Obtains the specified lock mode if the instance exists, implicitly + /// checking whether the corresponding database entry still exists + /// (throwing an OptimisticLockingFailureException if not found). + /// + /// In case of Hibernate errors + public void Delete(object entity, LockMode lockMode) + { + Execute(new DeleteLockModeHibernateCallback(this, entity, lockMode), true); + } + + /// + /// Delete all objects returned by the query. + /// + /// a query expressed in Hibernate's query language. + /// The number of entity instances deleted. + /// In case of Hibernate errors + public int Delete(string queryString) + { + return Delete(queryString, (Object[]) null, (IType[]) null); + } + + /// + /// Delete all objects returned by the query. + /// + /// a query expressed in Hibernate's query language. + /// The value of the parameter. + /// The Hibernate type of the parameter (or null). + /// The number of entity instances deleted. + /// In case of Hibernate errors + public int Delete(string queryString, object value, IType type) + { + return Delete(queryString, new Object[] {value}, new IType[] {type}); + } + + /// + /// Delete all objects returned by the query. + /// + /// a query expressed in Hibernate's query language. + /// The values of the parameters. + /// Hibernate types of the parameters (or null) + /// The number of entity instances deleted. + /// In case of Hibernate errors + /// If length for argument values and types are not equal. + public int Delete(String queryString, Object[] values, IType[] types) + { + if (values != null && types != null && values.Length != types.Length) + { + throw new ArgumentOutOfRangeException("values", "Length of values array must match length of types array"); + } + return (int)Execute(new DeletebyQueryHibernateCallback(this, queryString, values, types),true); + + } + + + /// + /// Delete all given persistent instances. + /// + /// The persistent instances to delete. + /// + /// This can be combined with any of the find methods to delete by query + /// in two lines of code, similar to Session's delete by query methods. + /// + /// In case of Hibernate errors + public void DeleteAll(ICollection entities) + { + Execute(new DeleteAllHibernateCallback(this, entities),true); + } + + + /// + /// Execute the action specified by the given action object within a Session. + /// + /// + /// Application exceptions thrown by the action object get propagated to the + /// caller (can only be unchecked). Hibernate exceptions are transformed into + /// appropriate DAO ones. Allows for returning a result object, i.e. a domain + /// object or a collection of domain objects. + ///

Note: Callback code is not supposed to handle transactions itself! + /// Use an appropriate transaction manager like HibernateTransactionManager. + /// Generally, callback code must not touch any Session lifecycle methods, + /// like close, disconnect, or reconnect, to let the template do its work. + ///

+ ///
+ /// The delegate callback object that specifies the Hibernate action. + /// a result object returned by the action, or null + /// + /// In case of Hibernate errors + public object Execute(HibernateDelegate del) + { + return Execute(new ExecuteHibernateCallbackUsingDelegate(del)); + } + + /// + /// Execute the action specified by the delegate within a Session. + /// + /// The HibernateDelegate that specifies the action + /// to perform. + /// if set to true expose the native hibernate session to + /// callback code. + /// a result object returned by the action, or null + /// + public object Execute(HibernateDelegate del, bool exposeNativeSession) + { + return Execute(new ExecuteHibernateCallbackUsingDelegate(del), true); + } + + /// + /// Execute the action specified by the given action object within a Session. + /// + /// The callback object that specifies the Hibernate action. + /// + /// a result object returned by the action, or null + /// + /// + /// Application exceptions thrown by the action object get propagated to the + /// caller (can only be unchecked). Hibernate exceptions are transformed into + /// appropriate DAO ones. Allows for returning a result object, i.e. a domain + /// object or a collection of domain objects. + ///

Note: Callback code is not supposed to handle transactions itself! + /// Use an appropriate transaction manager like HibernateTransactionManager. + /// Generally, callback code must not touch any Session lifecycle methods, + /// like close, disconnect, or reconnect, to let the template do its work. + ///

+ ///
+ /// In case of Hibernate errors + public object Execute(IHibernateCallback action) + { + return Execute(action, ExposeNativeSession); + } + + /// + /// Execute the specified action assuming that the result object is a List. + /// + /// + /// This is a convenience method for executing Hibernate find calls or + /// queries within an action. + /// + /// The calback object that specifies the Hibernate action. + /// A IList returned by the action, or null + /// + /// In case of Hibernate errors + public IList ExecuteFind(IHibernateCallback action) + { + Object result = Execute(action, ExposeNativeSession); + if (result != null && !(result is IList)) { + throw new InvalidDataAccessApiUsageException( + "Result object returned from HibernateCallback isn't a List: [" + result + "]"); + } + return (IList) result; + } + + /// + /// Execute the action specified by the given action object within a Session. + /// + /// callback object that specifies the Hibernate action. + /// if set to true expose the native hibernate session to + /// callback code. + /// + /// a result object returned by the action, or null + /// + public object Execute(IHibernateCallback action, bool exposeNativeSession) + { + ISession session = Session; + + bool existingTransaction = SessionFactoryUtils.IsSessionTransactional(session, SessionFactory); + if (existingTransaction) + { + if(log.IsDebugEnabled) log.Debug("Found thread-bound Session for HibernateTemplate"); + } + + FlushModeHolder previousFlushModeHolder = new FlushModeHolder(); + try + { + previousFlushModeHolder = ApplyFlushMode(session, existingTransaction); + ISession sessionToExpose = (exposeNativeSession ? session : CreateSessionProxy(session)); + Object result = action.DoInHibernate(sessionToExpose); + FlushIfNecessary(session, existingTransaction); + return result; + } + catch (ADOException ex) + { + IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(SessionFactory); + if (dbProvider != null && dbProvider.IsDataAccessException(ex.InnerException)) + { + throw ConvertAdoAccessException(ex); + } + else + { + throw new HibernateSystemException(ex); + } + } + catch (HibernateException ex) + { + throw ConvertHibernateAccessException(ex); + } + catch (Exception ex) + { + IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(SessionFactory); + if (dbProvider != null && dbProvider.IsDataAccessException(ex)) + { + throw ConvertAdoAccessException(ex); + } + else + { + // Callback code throw application exception or other non DB related exception. + throw; + } + } + finally + { + if (existingTransaction) + { + if (log.IsDebugEnabled) log.Debug("Not closing pre-bound Hibernate Session after HibernateTemplate"); + if (previousFlushModeHolder.ModeWasSet) + { + session.FlushMode = previousFlushModeHolder.Mode; + } + } + else + { + // Never use deferred close for an explicitly new Session. + if (AlwaysUseNewSession) + { + SessionFactoryUtils.CloseSession(session); + } + else + { + SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, SessionFactory); + } + } + } + } + + /// + /// Execute a query for persistent instances. + /// + /// a query expressed in Hibernate's query language + /// + /// a List containing 0 or more persistent instances + /// + /// In case of Hibernate errors + public IList Find(string queryString) + { + return Find(queryString, (object[])null, (IType[])null ); + } + + /// + /// Execute a query for persistent instances, binding + /// one value to a "?" parameter in the query string. + /// + /// a query expressed in Hibernate's query language + /// the value of the parameter + /// + /// a List containing 0 or more persistent instances + /// + /// In case of Hibernate errors + public IList Find(string queryString, object value) + { + return Find(queryString, new object[] {value}, (IType[]) null); + } + + /// + /// Execute a query for persistent instances, binding one value + /// to a "?" parameter of the given type in the query string. + /// + /// a query expressed in Hibernate's query language + /// The value of the parameter. + /// Hibernate type of the parameter (or null) + /// + /// a List containing 0 or more persistent instances + /// + /// In case of Hibernate errors + public IList Find(string queryString, object value, IType type) + { + return Find(queryString, new object[] {value}, new IType[] {type}); + } + + /// + /// Execute a query for persistent instances, binding a + /// number of values to "?" parameters in the query string. + /// + /// a query expressed in Hibernate's query language + /// the values of the parameters + /// a List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList Find(string queryString, object[] values) + { + return Find(queryString, values, (IType[]) null); + } + + /// + /// Execute a query for persistent instances, binding a number of + /// values to "?" parameters of the given types in the query string. + /// + /// A query expressed in Hibernate's query language + /// The values of the parameters + /// Hibernate types of the parameters (or null) + /// + /// a List containing 0 or more persistent instances + /// + /// In case of Hibernate errors + /// If values and types are not null and their lengths are not equal + public IList Find(string queryString, object[] values, IType[] types) + { + if (values != null && types != null && values.Length != types.Length) + { + throw new ArgumentException("Length of values array must match length of types array"); + } + return (IList)Execute(new FindHibernateCallback(this, queryString, values, types),true); + } + + /// + /// Execute a query for persistent instances, binding + /// one value to a named parameter in the query string. + /// + /// The name of a Hibernate query in a mapping file + /// The name of the parameter + /// The value of the parameter + /// a List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedParam(string queryName, string paramName, object value) + { + return FindByNamedParam(queryName, paramName, value, null); + } + + /// + /// Execute a query for persistent instances, binding + /// one value to a named parameter in the query string. + /// + /// The name of a Hibernate query in a mapping file + /// The name of the parameter + /// The value of the parameter + /// Hibernate type of the parameter (or null) + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedParam(string queryName, string paramName, object value, IType type) + { + return FindByNamedParam(queryName, new string[] {paramName}, new object[] {value}, new IType[] {type}); + } + + /// + /// Execute a query for persistent instances, binding a + /// number of values to named parameters in the query string. + /// + /// A query expressed in Hibernate's query language + /// The names of the parameters + /// The values of the parameters + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedParam(string queryString, string[] paramNames, object[] values) + { + return FindByNamedParam(queryString, paramNames, values, null); + } + + /// + /// Execute a query for persistent instances, binding a + /// number of values to named parameters in the query string. + /// + /// A query expressed in Hibernate's query language + /// The names of the parameters + /// The values of the parameters + /// Hibernate types of the parameters (or null) + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + /// If paramNames length is not equal to values length or + /// if paramNames length is not equal to types length (when types is not null) + public IList FindByNamedParam(string queryString, string[] paramNames, object[] values, IType[] types) + { + if (paramNames.Length != values.Length) + { + throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of values array"); + } + if (types != null && paramNames.Length != types.Length) + { + throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of types array"); + } + + return (IList)Execute(new FindByNamedParamHibernateCallback(this, queryString, paramNames, values, types),true); + + } + + /// + /// Execute a named query for persistent instances. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQuery(string queryName) + { + return FindByNamedQuery(queryName, (object[]) null, (IType[]) null); + } + + /// + /// Execute a named query for persistent instances, binding + /// one value to a "?" parameter in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The value of the parameter + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQuery(string queryName, object value) + { + return FindByNamedQuery(queryName, new object[] {value}, (IType[]) null); + } + + /// + /// Execute a named query for persistent instances, binding + /// one value to a "?" parameter in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The value of the parameter + /// Hibernate type of the parameter (or null) + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQuery(string queryName, object value, IType type) + { + return FindByNamedQuery(queryName, new object[] { value }, new IType[] { type }); + } + + /// + /// Execute a named query for persistent instances, binding a + /// number of values to "?" parameters in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The values of the parameters + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQuery(string queryName, object[] values) + { + return FindByNamedQuery(queryName, values, (IType[]) null); + } + + /// + /// Execute a named query for persistent instances, binding a + /// number of values to "?" parameters in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The values of the parameters + /// Hibernate types of the parameters (or null) + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + /// If values and types are not null and their lengths differ. + public IList FindByNamedQuery(string queryName, object[] values, IType[] types) + { + if (values != null && types != null && values.Length != types.Length) + { + throw new ArgumentOutOfRangeException("Length of values array must match length of types array"); + } + return (IList)Execute(new FindByNamedQueryHibernateCallback(this, queryName, values, types),true); + + + } + + /// + /// Execute a named query for persistent instances, binding + /// one value to a named parameter in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// Name of the parameter + /// The value of the parameter + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value) + { + return FindByNamedQueryAndNamedParam(queryName, paramName, value, null); + + } + + /// + /// Execute a named query for persistent instances, binding + /// one value to a named parameter in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// Name of the parameter + /// The value of the parameter + /// The Hibernate type of the parameter (or null) + /// A List containing 0 or more persistent instances + public IList FindByNamedQueryAndNamedParam(string queryName, string paramName, object value, IType type) + { + return FindByNamedQueryAndNamedParam( + queryName, new string[] {paramName}, new object[] {value}, new IType[] {type}); + + } + + /// + /// Execute a named query for persistent instances, binding + /// number of values to named parameters in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The names of the parameters + /// The values of the parameters. + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values) + { + return FindByNamedQueryAndNamedParam(queryName, paramNames, values, null); + + } + + /// + /// Execute a named query for persistent instances, binding + /// number of values to named parameters in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The names of the parameters + /// The values of the parameters. + /// Hibernate types of the parameters (or null) + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + /// If paramNames length is not equal to values length or + /// if paramNames length is not equal to types length (when types is not null) + public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values, IType[] types) + { + if (paramNames != null && values != null && paramNames.Length != values.Length) + { + throw new ArgumentOutOfRangeException("paramNames","Length of paramNames array must match length of values array"); + } + if (paramNames != null && types != null && paramNames.Length != types.Length) + { + throw new ArgumentOutOfRangeException("paramNams","Length of paramNames array must match length of types array"); + } + return (IList)Execute(new FindByNamedQueryAndNamedParamHibernateCallback(this, queryName, paramNames, values, types),true); + + } + + /// + /// Execute a named query for persistent instances, binding the properties + /// of the given object to named parameters in the query string. + /// A named query is defined in a Hibernate mapping file. + /// + /// The name of a Hibernate query in a mapping file + /// The values of the parameters + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByNamedQueryAndValueObject(string queryName, object valueObject) + { + return (IList)Execute(new FindByNamedQueryAndValueObjectHibernateCallback(this, queryName, valueObject),true); + + } + + /// + /// Execute a query for persistent instances, binding the properties + /// of the given object to named parameters in the query string. + /// + /// A query expressed in Hibernate's query language + /// The values of the parameters + /// A List containing 0 or more persistent instances + /// In case of Hibernate errors + public IList FindByValueObject(string queryString, object valueObject) + { + return (IList)Execute(new FindByValueObjectHibernateCallback(this, queryString, valueObject), true); + } + + #endregion + + #region Methods + + + /// + /// Create a close-suppressing proxy for the given Hibernate Session. + /// The proxy also prepares returned Query and Criteria objects. + /// + /// The session. + /// The session proxy. + public virtual ISession CreateSessionProxy(ISession session) + { + //TODO can move to HibernateAccessor and make protected + // if issue reported with AOP+Multiple Threads resolve. + // have not been able to reproduce so added lock as a precaution. + // + lock (syncRoot) + { + if (sessionProxyFactory == null) + { + sessionProxyFactory = new ProxyFactory(); + sessionProxyFactory.AddAdvice(new CloseSuppressingMethodInterceptor(this)); + } + + sessionProxyFactory.Target = session; + + return (ISession)sessionProxyFactory.GetProxy(); + } + } + + /// + /// Check whether write operations are allowed on the given Session. + /// + /// + /// Default implementation throws an InvalidDataAccessApiUsageException + /// in case of FlushMode.Never. Can be overridden in subclasses. + /// + /// The current Hibernate session. + /// If write operation is attempted in read-only mode + /// + public virtual void CheckWriteOperationAllowed(ISession session) + { + if (CheckWriteOperations && TemplateFlushMode != TemplateFlushMode.Eager && + AreEqualFlushMode(TemplateFlushMode.Never, session.FlushMode)) + { + throw new InvalidDataAccessApiUsageException( + "Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session " + + "into FlushMode.AUTO or remove 'readOnly' marker from transaction definition"); + } + } + + + + /// + /// Compares if the flush mode enumerations, Spring's + /// TemplateFlushMode and NHibernates FlushMode have equal + /// settings. + /// + /// The template flush mode. + /// The NHibernate flush mode. + /// + /// Returns true if both are Never, Auto, or Commit, false + /// otherwise. + /// + protected bool AreEqualFlushMode(TemplateFlushMode tfm, FlushMode fm) + { + if ( (tfm ==TemplateFlushMode.Never && fm == FlushMode.Never) || + (tfm ==TemplateFlushMode.Auto && fm == FlushMode.Auto) || + (tfm ==TemplateFlushMode.Commit && fm == FlushMode.Commit) ) + { + return true; + } + else + { + return false; + } + //TODO other combinations. + } + + #endregion + } + + #region Internal Supporting Callback Classes + + //TODO see if can create common base class for some callbacks. + + internal class ContainsHibernateCallback : IHibernateCallback + { + private object entity; + public ContainsHibernateCallback(object entity) + { + this.entity = entity; + } + + public object DoInHibernate(ISession session) + { + return session.Contains(entity); + } + } + + + internal class DeleteLockModeHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private object entity; + private LockMode lockMode; + public DeleteLockModeHibernateCallback(HibernateTemplate template, object entity, LockMode lockMode) + { + this.outer = template; + this.entity = entity; + this.lockMode = lockMode; + } + + public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + if (lockMode != null) + { + session.Lock(entity, lockMode); + } + session.Delete(entity); + return null; + } + } + + + internal class DeletebyQueryHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private string queryString; + private object[] values; + private IType[] types; + + public DeletebyQueryHibernateCallback(HibernateTemplate template, string queryString, object[] values, IType[] types) + { + this.outer = template; + this.queryString = queryString; + this.values = values; + this.types = types; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + if (values != null) + { + return session.Delete(queryString, values, types); + } + else + { + return session.Delete(queryString); + } + } + } + + + + internal class DeleteAllHibernateCallback : IHibernateCallback + { + HibernateTemplate outer; + private ICollection entities; + + public DeleteAllHibernateCallback(HibernateTemplate template, ICollection entities) + { + this.outer = template; + this.entities = entities; + + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + foreach (object entity in entities) + { + session.Delete(entity); + } + return null; + } + + + + } + + + internal class EvictHibernateCallback : IHibernateCallback + { + private object entity; + + public EvictHibernateCallback(object entity) + { + this.entity = entity; + + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + session.Evict(entity); + return null; + } + + + + } + + + internal class FindHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private string queryString; + private object[] values; + private IType[] types; + + public FindHibernateCallback(HibernateTemplate template, string queryString, object[] values, IType[] types) + { + this.outer = template; + this.queryString = queryString; + this.values = values; + this.types = types; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + IQuery queryObject = session.CreateQuery(queryString); + outer.PrepareQuery(queryObject); + if (values != null) + { + for (int i = 0; i < values.Length; i++) + { + if (types != null && types[i] != null) + { + queryObject.SetParameter(i, values[i], types[i]); + } + else + { + queryObject.SetParameter(i, values[i]); + } + } + } + + return queryObject.List(); + } + } + + + internal class FindByNamedParamHibernateCallback : IHibernateCallback + { + HibernateTemplate outer; + private string queryString; + private string[] paramNames; + private object[] values; + private IType[] types; + + public FindByNamedParamHibernateCallback(HibernateTemplate template, string queryString, string[] paramNames, object[] values, IType[] types) + { + this.outer = template; + this.queryString = queryString; + this.paramNames = paramNames; + this.values = values; + this.types = types; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + IQuery queryObject = session.CreateQuery(queryString); + outer.PrepareQuery(queryObject); + if (values != null) + { + for (int i = 0; i < values.Length; i++) + { + outer.ApplyNamedParameterToQuery(queryObject, paramNames[i], values[i], (types != null ? types[i] : null)); + } + } + return queryObject.List(); + + } + } + + + internal class FindByNamedQueryHibernateCallback : IHibernateCallback + { + HibernateTemplate outer; + private string queryName; + private object[] values; + private IType[] types; + + public FindByNamedQueryHibernateCallback(HibernateTemplate template, string queryName, object[] values, IType[] types) + { + this.outer = template; + this.queryName = queryName; + this.values = values; + this.types = types; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + IQuery queryObject = session.GetNamedQuery(queryName); + outer.PrepareQuery(queryObject); + if (values != null) + { + for (int i = 0; i < values.Length; i++) + { + if (types != null && types[i] != null) + { + queryObject.SetParameter(i, values[i], types[i]); + } + else + { + queryObject.SetParameter(i, values[i]); + } + } + } + return queryObject.List(); + + } + } + + + internal class FindByNamedQueryAndNamedParamHibernateCallback : IHibernateCallback + { + HibernateTemplate outer; + private string queryName; + private string[] paramNames; + private object[] values; + private IType[] types; + + public FindByNamedQueryAndNamedParamHibernateCallback(HibernateTemplate template, string queryName, string[] paramNames, object[] values, IType[] types) + { + this.outer = template; + this.queryName = queryName; + this.paramNames = paramNames; + this.values = values; + this.types = types; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + IQuery queryObject = session.GetNamedQuery(queryName); + outer.PrepareQuery(queryObject); + if (values != null) + { + for (int i = 0; i < values.Length; i++) + { + outer.ApplyNamedParameterToQuery(queryObject, paramNames[i], values[i], (types != null ? types[i] : null)); + } + } + return queryObject.List(); + + } + } + + + internal class FindByNamedQueryAndValueObjectHibernateCallback : IHibernateCallback + { + HibernateTemplate outer; + private string queryName; + private object valueObject; + + public FindByNamedQueryAndValueObjectHibernateCallback(HibernateTemplate template, string queryName, object valueObject) + { + this.outer = template; + this.queryName = queryName; + this.valueObject = valueObject; + + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + IQuery queryObject = session.GetNamedQuery(queryName); + outer.PrepareQuery(queryObject); + queryObject.SetProperties(valueObject); + return queryObject.List(); + + } + + + + } + + internal class FindByValueObjectHibernateCallback : IHibernateCallback + { + HibernateTemplate outer; + private string queryString; + private object valueObject; + + public FindByValueObjectHibernateCallback(HibernateTemplate template, string queryString, object valueObject) + { + this.outer = template; + this.queryString = queryString; + this.valueObject = valueObject; + + } + + public object DoInHibernate(ISession session) + { + IQuery queryObject = session.CreateQuery(queryString); + outer.PrepareQuery(queryObject); + queryObject.SetProperties(valueObject); + return queryObject.List(); + + } + + } + + internal class ExecuteHibernateCallbackUsingDelegate : IHibernateCallback + { + private HibernateDelegate del; + + public ExecuteHibernateCallbackUsingDelegate(HibernateDelegate d) + { + del = d; + } + + public object DoInHibernate(ISession session) + { + return del(session); + } + } + + + internal class GetByTypeHibernateCallback : IHibernateCallback + { + private Type entityType; + private object id; + private LockMode lockMode; + + public GetByTypeHibernateCallback(Type entityType, object id, LockMode lockMode) + { + this.entityType = entityType; + this.id = id; + this.lockMode = lockMode; + + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + if (lockMode != null) + { + return session.Get(entityType, id, lockMode); + } + else + { + return session.Get(entityType, id); + } + } + + + + } + + + internal class LoadByTypeHibernateCallback : IHibernateCallback + { + private Type entityType; + private object id; + private LockMode lockMode; + + public LoadByTypeHibernateCallback(Type entityType, object id, LockMode lockMode) + { + this.entityType = entityType; + this.id = id; + this.lockMode = lockMode; + + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + if (lockMode != null) + { + return session.Load(entityType, id, lockMode); + } + else + { + return session.Load(entityType, id); + } + } + + + + } + + + internal class LoadByEntityHibernateCallback : IHibernateCallback + { + private object entity; + private object id; + + public LoadByEntityHibernateCallback(object entity, object id) + { + this.entity = entity; + this.id = id; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + session.Load(entity, id); + return null; + } + + + + } + + + internal class LoadAllByTypeHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private Type entityType; + + public LoadAllByTypeHibernateCallback(HibernateTemplate template, Type entityType) + { + outer = template; + this.entityType = entityType; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + ICriteria criteria = session.CreateCriteria(entityType); + outer.PrepareCriteria(criteria); + return criteria.List(); + } + } + + + internal class LockHibernateCallback : IHibernateCallback + { + private object entity; + private LockMode lockMode; + + public LockHibernateCallback(object entity, LockMode lockMode) + { + this.entity = entity; + this.lockMode = lockMode; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + session.Lock(entity, lockMode); + return null; + } + } + + + internal class RefreshHibernateCallback : IHibernateCallback + { + private object entity; + private LockMode lockMode; + + public RefreshHibernateCallback(object entity, LockMode lockMode) + { + this.entity = entity; + this.lockMode = lockMode; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + if (lockMode != null) + { + session.Refresh(entity, lockMode); + } + else + { + session.Refresh(entity); + } + return null; + } + } + + + internal class SaveObjectHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private object entity; + + public SaveObjectHibernateCallback(HibernateTemplate template, object entity) + { + this.outer = template; + this.entity = entity; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + return session.Save(entity); + } + } + + + internal class SaveObjectWithIdHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private object entity; + private object id; + + public SaveObjectWithIdHibernateCallback(HibernateTemplate template, object entity, object id) + { + this.outer = template; + this.entity = entity; + this.id = id; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + session.Save(entity, id); + return null; + } + } + + + internal class UpdateObjectHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private object entity; + private LockMode lockMode; + + public UpdateObjectHibernateCallback(HibernateTemplate template, object entity, LockMode lockMode) + { + this.outer = template; + this.entity = entity; + this.lockMode = lockMode; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + session.Update(entity); + if (lockMode != null) + { + session.Lock(entity, lockMode); + } + return null; + } + } + + + internal class SaveOrUpdateObjectHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private object entity; + + public SaveOrUpdateObjectHibernateCallback(HibernateTemplate template, object entity) + { + this.outer = template; + this.entity = entity; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + session.SaveOrUpdate(entity); + return null; + } + } + + internal class SaveOrUpdateAllHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private ICollection entities; + + public SaveOrUpdateAllHibernateCallback(HibernateTemplate template, ICollection entities) + { + this.outer = template; + this.entities = entities; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + foreach (object entity in entities) + { + session.SaveOrUpdate(entity); + } + return null; + } + } + internal class SaveOrUpdateCopyHibernateCallback : IHibernateCallback + { + private HibernateTemplate outer; + private object entity; + + public SaveOrUpdateCopyHibernateCallback(HibernateTemplate template, object entity) + { + this.outer = template; + this.entity = entity; + } + + /// + /// Gets called by HibernateTemplate with an active + /// Hibernate Session. Does not need to care about activating or closing + /// the Session, or handling transactions. + /// + /// + ///

+ /// Allows for returning a result object created within the callback, i.e. + /// a domain object or a collection of domain objects. Note that there's + /// special support for single step actions: see HibernateTemplate.find etc. + ///

+ ///
+ public object DoInHibernate(ISession session) + { + outer.CheckWriteOperationAllowed(session); + // As of NH 3.1 SaveOrUpdateCopy is obsolete, disable compiler warning for now +#pragma warning disable 618 return session.SaveOrUpdateCopy(entity); - } +#pragma warning restore 618 + } } #if !NH_1_2 @@ -2279,10 +2282,10 @@ namespace Spring.Data.NHibernate outer.CheckWriteOperationAllowed(session); return session.Merge(entity); } - } -#endif - - #endregion - - -} + } +#endif + + #endregion + + +} diff --git a/src/Spring/Spring.Data.NHibernate31/AssemblyInfo.cs b/src/Spring/Spring.Data.NHibernate31/AssemblyInfo.cs new file mode 100644 index 00000000..d62410af --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Spring.Net NHibernate 3.1 support")] +[assembly: AssemblyDescription("Interfaces and classes that provide NHibernate 3.1 support in Spring.Net")] \ No newline at end of file diff --git a/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Bytecode/dontdelete.txt b/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Bytecode/dontdelete.txt new file mode 100644 index 00000000..9b957720 --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Bytecode/dontdelete.txt @@ -0,0 +1 @@ +sources are linked here from Spring.Data.NHibernate21 \ No newline at end of file diff --git a/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Generic/dontdelete.txt b/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Generic/dontdelete.txt new file mode 100644 index 00000000..b4472e3f --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Generic/dontdelete.txt @@ -0,0 +1 @@ +sources are linked here from Spring.Data.NHibernate \ No newline at end of file diff --git a/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Support/dontdelete.txt b/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Support/dontdelete.txt new file mode 100644 index 00000000..b4472e3f --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Data/NHibernate/Support/dontdelete.txt @@ -0,0 +1 @@ +sources are linked here from Spring.Data.NHibernate \ No newline at end of file diff --git a/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.2008.csproj b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.2008.csproj new file mode 100644 index 00000000..890d81f0 --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.2008.csproj @@ -0,0 +1,190 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {1C8E0481-A70D-445E-AB4D-4A963CF7DC83} + Library + Properties + Spring + Spring.Data.NHibernate31 + v2.0 + + + true + full + false + ..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31\Debug\ + TRACE;DEBUG;NET_2_0,NH_2_1 + prompt + 4 + Spring.Data.NHibernate31.xml + true + + + + + pdbonly + true + ..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31\Release\ + TRACE;NET_2_0,NH_2_1 + prompt + 4 + Spring.Data.NHibernate31.xml + true + + + + False + ..\..\..\lib\Net\2.0\Common.Logging.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\NHibernate.dll + + + + + + + + + CommonAssemblyInfo.cs + + + Data\NHibernate\Generic\FindHibernateDelegate.cs + + + Data\NHibernate\Generic\HibernateDaoSupport.cs + + + Data\NHibernate\Generic\HibernateDelegate.cs + + + Data\NHibernate\Generic\HibernateTemplate.cs + + + Data\NHibernate\Generic\IFindHibernateCallback.cs + + + Data\NHibernate\Generic\IHibernateCallback.cs + + + Data\NHibernate\Generic\IHibernateOperations.cs + + + Data\NHibernate\HibernateAccessor.cs + + + Data\NHibernate\SpringSessionContext.cs + + + Data\NHibernate\SpringSessionSynchronization.cs + + + Data\NHibernate\Bytecode\BytecodeProvider.cs + + + Data\NHibernate\Bytecode\LazyInitializer.cs + + + Data\NHibernate\Bytecode\ObjectsFactory.cs + + + Data\NHibernate\Bytecode\ProxyFactory.cs + + + Data\NHibernate\Bytecode\ProxyFactoryFactory.cs + + + Data\NHibernate\Bytecode\ReflectionOptimizer.cs + + + Data\NHibernate\HibernateAdoException.cs + + + Data\NHibernate\HibernateDelegate.cs + + + Data\NHibernate\HibernateQueryException.cs + + + Data\NHibernate\HibernateSystemException.cs + + + Data\NHibernate\HibernateTemplate.cs + + + Data\NHibernate\HibernateTransactionManager.cs + + + Data\NHibernate\ICommonHibernateOperations.cs + + + Data\NHibernate\IHibernateCallback.cs + + + Data\NHibernate\IHibernateOperations.cs + + + Data\NHibernate\SessionFactoryUtils.cs + + + Data\NHibernate\SessionHolder.cs + + + Data\NHibernate\Support\ConfigSectionSessionScopeSettings.cs + + + Data\NHibernate\Support\HibernateDaoSupport.cs + + + Data\NHibernate\Support\OpenSessionInViewModule.cs + + + Data\NHibernate\Support\SessionScope.cs + + + Data\NHibernate\Support\SessionScopeSettings.cs + + + Data\NHibernate\TemplateFlushMode.cs + + + Data\NHibernate\FilterDefiniitionFactoryObject.cs + + + Data\NHibernate\HibernateObjectRetrievalFailureException.cs + + + Data\NHibernate\HibernateOptimisticLockingFailureException.cs + + + Data\NHibernate\LocalSessionFactoryObject.cs + + + + + + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} + Spring.Aop.2008 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2008 + + + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40} + Spring.Data.2008 + + + + + \ No newline at end of file diff --git a/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.2010.csproj b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.2010.csproj new file mode 100644 index 00000000..10ad4b7e --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.2010.csproj @@ -0,0 +1,206 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {66DCCF2A-5E28-4539-8F8A-C8DDB9E54CC4} + Library + Properties + Spring + Spring.Data.NHibernate31 + v3.5 + + + 3.5 + + + + + true + full + false + ..\..\..\build\VS.Net.2010\Spring.Data.NHibernate31\Debug\ + TRACE;DEBUG;NET_2_0,NH_2_1 + prompt + 4 + Spring.Data.NHibernate31.xml + true + + + + + pdbonly + true + ..\..\..\build\VS.Net.2010\Spring.Data.NHibernate31\Release\ + TRACE;NET_2_0,NH_2_1 + prompt + 4 + + + + False + ..\..\..\lib\Net\2.0\Common.Logging.dll + + + ..\..\..\lib\NHibernate31\net\3.5\NHibernate.dll + + + + + + + + + + CommonAssemblyInfo.cs + + + Data\NHibernate\Generic\FindHibernateDelegate.cs + + + Data\NHibernate\Generic\HibernateDaoSupport.cs + + + Data\NHibernate\Generic\HibernateDelegate.cs + + + Data\NHibernate\Generic\HibernateTemplate.cs + + + Data\NHibernate\Generic\IFindHibernateCallback.cs + + + Data\NHibernate\Generic\IHibernateCallback.cs + + + Data\NHibernate\Generic\IHibernateOperations.cs + + + Data\NHibernate\HibernateAccessor.cs + + + Data\NHibernate\SpringSessionContext.cs + + + Data\NHibernate\SpringSessionSynchronization.cs + + + Data\NHibernate\Bytecode\BytecodeProvider.cs + + + Data\NHibernate\Bytecode\LazyInitializer.cs + + + Data\NHibernate\Bytecode\ObjectsFactory.cs + + + Data\NHibernate\Bytecode\ProxyFactory.cs + + + Data\NHibernate\Bytecode\ProxyFactoryFactory.cs + + + Data\NHibernate\Bytecode\ReflectionOptimizer.cs + + + Data\NHibernate\DelegatingLocalSessionFactoryObject.cs + + + Data\NHibernate\DelegatingSessionFactory.cs + + + Data\NHibernate\HibernateTxScopeTransactionManager.cs + + + Data\NHibernate\SimpleDelegatingSessionFactory.cs + + + Data\NHibernate\HibernateAdoException.cs + + + Data\NHibernate\HibernateDelegate.cs + + + Data\NHibernate\HibernateQueryException.cs + + + Data\NHibernate\HibernateSystemException.cs + + + Data\NHibernate\HibernateTemplate.cs + + + Data\NHibernate\HibernateTransactionManager.cs + + + Data\NHibernate\ICommonHibernateOperations.cs + + + Data\NHibernate\IHibernateCallback.cs + + + Data\NHibernate\IHibernateOperations.cs + + + Data\NHibernate\SessionFactoryUtils.cs + + + Data\NHibernate\SessionHolder.cs + + + Data\NHibernate\Support\ConfigSectionSessionScopeSettings.cs + + + Data\NHibernate\Support\HibernateDaoSupport.cs + + + Data\NHibernate\Support\OpenSessionInViewModule.cs + + + Data\NHibernate\Support\SessionScope.cs + + + Data\NHibernate\Support\SessionScopeSettings.cs + + + Data\NHibernate\TemplateFlushMode.cs + + + Data\NHibernate\FilterDefiniitionFactoryObject.cs + + + Data\NHibernate\HibernateObjectRetrievalFailureException.cs + + + Data\NHibernate\HibernateOptimisticLockingFailureException.cs + + + Data\NHibernate\LocalSessionFactoryObject.cs + + + + + + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} + Spring.Aop.2010 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2010 + + + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40} + Spring.Data.2010 + + + + + \ No newline at end of file diff --git a/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.build b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.build new file mode 100644 index 00000000..475d70fc --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.build @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.nuspec b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.nuspec new file mode 100644 index 00000000..5cdbaba7 --- /dev/null +++ b/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.nuspec @@ -0,0 +1,22 @@ + + + + + Spring.Data.NHibernate31 + Spring.Net NHibernate 3.1 support + http://www.springframework.net/ + http://www.springframework.net/license.html + SPRING_VERSION + SpringSource + Interfaces and classes that provide NHibernate 3.1 support in Spring.Net + Interfaces and classes that provide NHibernate 3.1 support in Spring.Net + en-US + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/AssemblyInfo.cs b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/AssemblyInfo.cs new file mode 100644 index 00000000..9db0ab65 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Reflection; + +[assembly: AssemblyTitle("Spring.Data.NHibernate31 Integration Tests")] +[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate31 assembly")] diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/Credit.hbm.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/Credit.hbm.xml new file mode 100644 index 00000000..a78a4865 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/Credit.hbm.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/Debit.hbm.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/Debit.hbm.xml new file mode 100644 index 00000000..0bafaa7a --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/Debit.hbm.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/MultipleDbTests.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/MultipleDbTests.xml new file mode 100644 index 00000000..daddfbd1 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/MultipleDbTests.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + Spring.Data.NHibernate31.Integration.Tests + + + + + + + + + + + + + + + + + + + + + + + + Spring.Data.NHibernate31.Integration.Tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transactionInterceptor + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/NHDAOTests.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/NHDAOTests.xml new file mode 100644 index 00000000..e8d56a35 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/NHDAOTests.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + Spring.Data.NHibernate31.Integration.Tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transactionInterceptor + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/TestObject.hbm.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/TestObject.hbm.xml new file mode 100644 index 00000000..c86706c3 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/TestObject.hbm.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml new file mode 100644 index 00000000..ed9298fb --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + assembly://Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/templateTests.xml b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/templateTests.xml new file mode 100644 index 00000000..c5cfe19c --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Data/NHibernate/templateTests.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + assembly://Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.2008.csproj b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.2008.csproj new file mode 100644 index 00000000..ced089f5 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.2008.csproj @@ -0,0 +1,165 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {CD6A49DE-745C-4360-AADF-3539CFEC6639} + Library + Properties + Spring + Spring.Data.NHibernate31.Integration.Tests + + + true + full + false + ..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Integration.Tests\Debug\ + TRACE;DEBUG;NET_2_0,NH_2_0,NH_2_1 + prompt + 4 + + + pdbonly + true + ..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Integration.Tests\Release\ + TRACE;NET_2_0,NH_2_0,NH_2_1 + prompt + 4 + + + + False + ..\..\..\lib\Net\2.0\Common.Logging.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\Iesi.Collections.dll + + + False + ..\..\..\lib\NHibernate30\net\3.5\log4net.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\NHibernate.dll + + + False + ..\..\..\lib\Net\2.0\nunit.framework.dll + + + + + + + + Data\NHibernate\AccountCreditDao.cs + + + Data\NHibernate\AccountDebitDao.cs + + + Data\NHibernate\AccountManager.cs + + + Data\NHibernate\AuditDao.cs + + + Data\NHibernate\Credit.cs + + + Data\NHibernate\DbProviderTemplateTests.cs + + + Data\NHibernate\Debit.cs + + + Data\NHibernate\IAccountCreditDao.cs + + + Data\NHibernate\IAccountDebitDao.cs + + + Data\NHibernate\IAccountManager.cs + + + Data\NHibernate\IAuditDao.cs + + + Data\NHibernate\ITestObjectDao.cs + + + Data\NHibernate\MultipleDbTests.cs + + + Data\NHibernate\NativeNHTestObjectDao.cs + + + Data\NHibernate\NativeNHTests.cs + + + Data\NHibernate\NHDAOTests.cs + + + Data\NHibernate\NHTestObjectDao.cs + + + Data\NHibernate\TemplateTests.cs + + + Data\NHibernate\TestObject.cs + + + + + + Data\NHibernate\creditdebit.sql + + + + + + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} + Spring.Aop.2008 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2008 + + + {71368632-B8B7-4A6A-8C65-8DA848120C82} + Spring.Data.NHibernate31.2008 + + + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40} + Spring.Data.2008 + + + + + + + + + + + + + + + + + + + echo "Copying .xml files for tests" +xcopy "$(ProjectDir)Data" ..\..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Integration.Tests\$(ConfigurationName)\ /y /s /q /d +xcopy "$(ProjectDir)$(TargetFileName).config" ..\..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Integration.Tests\$(ConfigurationName)\ /y /s /q + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.build b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.build new file mode 100644 index 00000000..f0f56044 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.build @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.dll.config b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.dll.config new file mode 100644 index 00000000..12e5ecbf --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Integration.Tests/Spring.Data.NHibernate31.Integration.Tests.dll.config @@ -0,0 +1,40 @@ + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/AssemblyInfo.cs b/test/Spring/Spring.Data.NHibernate31.Tests/AssemblyInfo.cs new file mode 100644 index 00000000..db417bb4 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Spring.Data.NHibernate31 Integration Tests")] +[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate31 assembly")] diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/Config/AopConfiguration.xml b/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/Config/AopConfiguration.xml new file mode 100644 index 00000000..cdbe4de9 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/Config/AopConfiguration.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + assembly://Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate/TestObject.hbm.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + loggingAroundAdvice + + + + + + + + + + TestObjectDao + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/Config/AopConfigurationTxPointcut.xml b/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/Config/AopConfigurationTxPointcut.xml new file mode 100644 index 00000000..d089e7af --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/Config/AopConfigurationTxPointcut.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + assembly://Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate/TestObject.hbm.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12341234asdf* + + + + + + + + + loggingAdvisor + + + + + + + + + + TestObjectDao + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/TestObject.hbm.xml b/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/TestObject.hbm.xml new file mode 100644 index 00000000..96a689ee --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Data/NHibernate/TestObject.hbm.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.2008.csproj b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.2008.csproj new file mode 100644 index 00000000..56d9506d --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.2008.csproj @@ -0,0 +1,141 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {231512F3-4F1D-45E1-BADE-D01F68DB9A80} + Library + Properties + Spring + Spring.Data.NHibernate31.Tests + + + true + full + false + ..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Tests\Debug\ + TRACE;DEBUG;NET_2_0,NH_2_0,NH_2_1 + prompt + 4 + + + pdbonly + true + ..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Tests\Release\ + TRACE;NET_2_0,NET_2_1 + prompt + 4 + + + + False + ..\..\..\lib\Net\2.0\Common.Logging.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\Iesi.Collections.dll + + + False + ..\..\..\lib\NHibernate30\net\3.5\log4net.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\NHibernate.dll + + + False + ..\..\..\lib\net\2.0\nunit.framework.dll + + + False + ..\..\..\lib\Net\2.0\Rhino.Mocks.dll + + + + + + + + Data\NHibernate\Config\AopConfiguration.cs + + + Data\NHibernate\HibernateTransactionManagerTests.cs + + + Data\NHibernate\ISimpleService.cs + + + Data\NHibernate\ITestObjectDao.cs + + + Data\NHibernate\LocalSessionFactoryObjectTests.cs + + + Data\NHibernate\NHTestObjectDao.cs + + + Data\NHibernate\SimpleService.cs + + + Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs + + + Data\NHibernate\Support\SessionScopeSettingsTests.cs + + + Data\NHibernate\Support\SessionScopeTests.cs + + + Data\NHibernate\TestObject.cs + + + + + Always + + + + + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} + Spring.Aop.2008 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2008 + + + {71368632-B8B7-4A6A-8C65-8DA848120C82} + Spring.Data.NHibernate31.2008 + + + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40} + Spring.Data.2008 + + + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0} + Spring.Data.Tests.2008 + + + + + + + + + + + + + echo "Copying .xml files for tests" +xcopy "$(ProjectDir)Data" ..\..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Tests\$(ConfigurationName)\ /y /s /q /d +xcopy "$(ProjectDir)$(TargetFileName).config" ..\..\..\..\build\VS.Net.2008\Spring.Data.NHibernate31.Tests\$(ConfigurationName)\ /y /s /q + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.2010.csproj b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.2010.csproj new file mode 100644 index 00000000..ae0338d5 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.2010.csproj @@ -0,0 +1,147 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {867628D8-DFCC-4D2A-A786-EB0D97DBC3DC} + Library + Properties + Spring + Spring.Data.NHibernate31.Tests + v4.0 + + + 3.5 + + + + + true + full + false + ..\..\..\build\VS.Net.2010\Spring.Data.NHibernate31.Tests\Debug\ + TRACE;DEBUG;NET_2_0,NH_2_0,NH_2_1 + prompt + 4 + + + pdbonly + true + ..\..\..\build\VS.Net.2010\Spring.Data.NHibernate31.Tests\Release\ + TRACE;NET_2_0,NET_2_1 + prompt + 4 + + + + False + ..\..\..\lib\Net\2.0\Common.Logging.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\Iesi.Collections.dll + + + ..\..\..\lib\NHibernate30\net\4.0\log4net.dll + + + False + ..\..\..\lib\NHibernate31\net\3.5\NHibernate.dll + + + False + ..\..\..\lib\net\2.0\nunit.framework.dll + + + False + ..\..\..\lib\Net\2.0\Rhino.Mocks.dll + + + + + + + + Data\NHibernate\Config\AopConfiguration.cs + + + Data\NHibernate\HibernateTransactionManagerTests.cs + + + Data\NHibernate\ISimpleService.cs + + + Data\NHibernate\ITestObjectDao.cs + + + Data\NHibernate\LocalSessionFactoryObjectTests.cs + + + Data\NHibernate\NHTestObjectDao.cs + + + Data\NHibernate\SimpleService.cs + + + Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs + + + Data\NHibernate\Support\SessionScopeSettingsTests.cs + + + Data\NHibernate\Support\SessionScopeTests.cs + + + Data\NHibernate\TestObject.cs + + + + + Always + + + + + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} + Spring.Aop.2010 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2010 + + + {71368632-B8B7-4A6A-8C65-8DA848120C82} + Spring.Data.NHibernate31.2010 + + + {AE00E5AB-C39A-436F-86D2-33BFE33E2E40} + Spring.Data.2010 + + + {ACD39D47-1811-40FA-9E7E-5DEA5B9CE6C0} + Spring.Data.Tests.2010 + + + + + + + + + + + + + echo "Copying .xml files for tests" +xcopy "$(ProjectDir)Data" ..\..\..\..\build\VS.Net.2010\Spring.Data.NHibernate31.Tests\$(ConfigurationName)\ /y /s /q /d +xcopy "$(ProjectDir)$(TargetFileName).config" ..\..\..\..\build\VS.Net.2010\Spring.Data.NHibernate31.Tests\$(ConfigurationName)\ /y /s /q + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.build b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.build new file mode 100644 index 00000000..ed6e9894 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.build @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.dll.config b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.dll.config new file mode 100644 index 00000000..3f8da4d1 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate31.Tests/Spring.Data.NHibernate31.Tests.dll.config @@ -0,0 +1,30 @@ + + + + +
+ + +
+ + + + + + + + + + + + + + \ No newline at end of file