forked from chucknorris/roundhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a workaround for a problem with NHibernate in combination with the Microsoft Oracle driver. See http://thebasilet.blogspot.be/2009/07/nhibernate-oracle-clobs.html for details
- Loading branch information
1 parent
8554ddd
commit e697175
Showing
5 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
product/roundhouse.databases.oracle/RoundhousEOracleDriver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Data.OracleClient; | ||
using NHibernate.Driver; | ||
using NHibernate.SqlTypes; | ||
using roundhouse.infrastructure.logging; | ||
|
||
namespace roundhouse.databases.oracle | ||
{ | ||
public class RoundhousEOracleDriver : OracleClientDriver | ||
{ | ||
protected override void InitializeParameter(System.Data.IDbDataParameter dbParam, string name, SqlType sqlType) | ||
{ | ||
base.InitializeParameter(dbParam, name, sqlType); | ||
|
||
//http://thebasilet.blogspot.be/2009/07/nhibernate-oracle-clobs.html | ||
//System.Data.OracleClient.dll driver generates an exception | ||
//we set the IDbDataParameter.Value = (string whose length: 4000 > length > 2000 ) | ||
//when we set the IDbDataParameter.DbType = DbType.String | ||
//when DB Column is of type NCLOB/CLOB | ||
//The Above is the default behavior for NHibernate.OracleClientDriver | ||
//So we use the built-in StringClobSqlType to tell the driver to use the NClob Oracle type | ||
//This will work for both NCLOB/CLOBs without issues. | ||
//Mapping file will need to be update to use StringClob as the property type | ||
if ((sqlType is StringClobSqlType)) | ||
{ | ||
((OracleParameter)dbParam).OracleType = OracleType.NClob; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters