4
votes

I am using Fluent NHibernate to query my Oracle 11g database. In the fluent mapping files I have a Mapping which looks like that

Map(x => x.WaterLevel).Formula("CAST(WATER_LEVEL AS DOUBLE PRECISION )")

However, when I run my tests I get

Oracle.DataAccess.Client.OracleException : ORA-00907: missing right parenthesis

Due to additional strings (this_.) in the SQL translation:

 CAST(this_.WATER_LEVEL AS this_.DOUBLE this_.PRECISION )

I have referred to How can you stop NHibernate (via ActiveRecord) adding this_. to a table name in a formula and How can I stop NHibernate adding "or this._property is null" to generated queries? but the solutions suggested did not work for me.

1

1 Answers

0
votes

The only way to reproduce your issue, was to turn off dialect setting. Other words, to use the NHibernate.Dialect.GenericDialect.

But any of these dialects, is working properly:

<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
  <session-factory name="myFactory">
     ...
     <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
     // or
     <property name="dialect">NHibernate.Dialect.Oracle9iDialect</property>
     // or
     <property name="dialect">NHibernate.Dialect.Oracle8iDialect</property>

So, you do not have to CREATE dialect as stated in the question. Just use one of the existing, which is always better choice then generic one...