views:

21

answers:

1

Hey, I am switching my application from Oracle 10g to SQL Server Compact. Currently I have this in the mapping file:

<id name="Id" column="MY_ID">
  <generator class="sequence">
    <param name="sequence">MY_SEQ</param>
  </generator>
</id>

and I have been informed that sequence does not exist in SQL Server Compact, I was wondering if there was an equivalent. Also I was wondering if I switch to SQL Server 2000/2005 if there is an equivalent.

+2  A: 

There are many options here:

GUID:

<id name="Id" column="MY_ID">
      <generator class="guid" />
</id>

Integral-type identities:

<id name="Id" column="MY_ID" type="Int32">
      <generator class="identity"/>
</id>

Native, i.e. identity, sequence or hilo depending upon the capabilities of the underlying database:

<id name="Id" column="MY_ID" type="Int32">
      <generator class="native"/>
</id>


More information::

Rafael Belliard