views:

27

answers:

0

I have a one-to-many mapping that works in sql lite, but then blows up in Oracle. If I make a slight change, it will work in Oracle, but not in SQLITE.

Here's my mappings:

This works in SQL Lite

<many-to-one class="NHibernate.Spike.Data.Entities.ClientRecord,
NHibernate.Spike.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null"
                 name="Client"
                 fetch="join"
                 cascade="none"/>

In Oracle, it adds CLient to the select, as if it were a column. It throws an invalid identifier exception in ORA.

If I add the column name, like this, it will work in ORA, but throws an exception in SQL LIte.

<many-to-one class="NHibernate.Spike.Data.Entities.ClientRecord,
NHibernate.Spike.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null"
                 name="Client"
                 fetch="join"
                 cascade="none"
                 column="`CLIENT_NUMBER`" />

Adding column above creates this exception in SQL Lite. For some reason, it tries to add another item for the CLIENT_NUMBER in the select.

My class has a property called CLIENT_NUMBER, which is not the key on this class. CLIENT_NUMBER is the key on the Client class that I am trying to reference.

 System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection.
Parameter name: index.

Here's how my CLIENT class is mapped with for the ID. The CLIENT_NUMBER column is assigned by another application.

<id name="ClientNumber" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" unsaved-value="0">
      <column name="`CLIENT_NUMBER`" default="0" />
      <generator class="assigned" />
    </id>

Does anyone know how I can resolve this?