Switching from Oracle 10g Express to SQL Server Compact (NHibernate)
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&g开发者_如何转开发t;
</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.
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::
- Understanding Hibernate 'generator' element
- Avoid identity generator when possible
精彩评论