Hi,
I recieve the ORA-12704: character set mismatch error when I attempt to fetch objects using a like expression in a criteria
for example:
criteria.Add(Expression.Like("Surname", surname, MatchMode.Start));
IList<Respondant> respondants = criteria.List<Respondant>();
If I just get the list of all records in the table it works for instance this works:
ICriteria criteria = session.CreateCriteria(typeof(Respondant));
IList<Respondant> respondants = criteria.List<Respondant>();
My mapping looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="DpdBusiness" namespace="Northgate.LandAndProperty.Dpd">
<class name="Respondant" table="REPRESENTOR">
<id name="Id" >
<column name="Link" sql-type="NUMBER" not-null="true" length="9"/>
<generator class="sequence">
<param name="sequence">LP_REPRESENTOR_SEQ</param>
</generator>
</id>
<property name="AgentNumber" column="REPRESENTORAGENTNUMBER"/>
<property name="Title" column="REPRESENTORTITLE"/>
<property name="FirstName" column="REPRESENTORFIRSTNAME"/>
<property name="Surname" >
<column name="REPRESENTORSURNAME" sql-type="VARCHAR2(20)"/>
</property>
<property name="Company" column="REPRESENTORCOMPANY"/>
<property name="HouseNameOrNumber" column="REPRESENTORNAMESEC"/>
<property name="StreetName" column="REPRESENTORSTREETNAME"/>
<property name="Locality" column="REPRESENTORLOCALITY"/>
</class>
</hibernate-mapping>
Though I have tried mapping the Surname property without the sql-type but still get the same error
1.2.0.1001
This is the output I get:
TestCase 'DpdBusinessUnitTests.DpdManagerBasicTests.FetchRespondantsMatchingSurname' failed: NHibernate.ADOException : could not execute query
----> System.Data.OracleClient.OracleException : ORA-12704: character set mismatch
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(1646,0): at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(1593,0): at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(1587,0): at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Criteria\CriteriaLoader.cs(65,0): at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session)
c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionImpl.cs(4907,0): at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results)
c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionImpl.cs(4856,0): at NHibernate.Impl.SessionImpl.Find[T](CriteriaImpl criteria)
c:\net\nhibernate\nhibernate\src\NHibernate\Impl\CriteriaImpl.cs(285,0): at NHibernate.Impl.CriteriaImpl.List[T]()
F:\Richard.Harding\Visual Studio 2005\Projects\LDFWorkFlowPrototype\DpdBusiness\DpdManager.cs(81,0): at Northgate.LandAndProperty.Dpd.DpdManager.FetchRespondantsMatchingSurname(String surname)
F:\Richard.Harding\Visual Studio 2005\Projects\LDFWorkFlowPrototype\DpdBusinessUnitTests\DpdManagerBasicTests.cs(58,0): at DpdBusinessUnitTests.DpdManagerBasicTests.FetchRespondantsMatchingSurname()
--ADOException
at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, ArrayList& resultParameterOrdinals)
at System.Data.OracleClient.OracleCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OracleClient.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
c:\net\nhibernate\nhibernate\src\NHibernate\Impl\BatcherImpl.cs(228,0): at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(1289,0): at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(393,0): at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(182,0): at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs(1636,0): at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
Out: NHibernate: SELECT this_.Link as Link0_, this_.REPRESENTORLOCALITY as REPRESEN9_0_0_, this_.REPRESENTORNAMESEC as REPRESEN7_0_0_, this_.REPRESENTORSURNAME as REPRESEN5_0_0_, this_.REPRESENTORTITLE as REPRESEN3_0_0_, this_.REPRESENTORSTREETNAME as REPRESEN8_0_0_, this_.REPRESENTORFIRSTNAME as REPRESEN4_0_0_, this_.REPRESENTORAGENTNUMBER as REPRESEN2_0_0_, this_.REPRESENTORCOMPANY as REPRESEN6_0_0_ FROM REPRESENTOR this_ WHERE this_.REPRESENTORSURNAME like :p0
:p0 = 'B%'
0 succeeded, 1 failed, 0 skipped, took 1.47 seconds.
[
The database is Oracle 817 and my nhibernate config looks like this:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
<session-factory>
<property name="dialect">NHibernate.Dialect.OracleDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Data Source=sx3wiz;Persist Security Info=True;User ID=lp;Password=lpsx3;</property>
<property name="hibernate.show_sql">true</property>
<mapping assembly="DpdBusiness" />
</session-factory>
</hibernate-configuration>
The generated sql looks ok to me so not sure what else to check?
any help or advice much appreciated
Thanks
Richard
|