<NativeIdGenerator> Element

Sets the identity strategy of the enclosing element to use the default identity strategy of the underlying relational database system.

<PersistentField [fieldName="fieldName"]>

       <NativeIdGenerator [value="enabled"] />

</PersistentField>

or

<PersistentField [fieldName="fieldName"]

[NativeIdGenerator="enabled"]

/>

enabled: If set to true, the field is initialised with an appropriate database platform-specific strategy.

Remarks

·    The NativeIdGenerator strategy uses a default strategy which depends on the actual database-platform the DataDomain schema is compiled for.

·    When the mapped field is of integer/numeric type: for MS SQL, this decalaration is the same as if <AutoIncrement> element is defined. For Oracle, this declaration is equivalent to a <Sequence> element declaration.

·    When the mapped field is of type Guid: for MS SQL 2005, this declaration is the same as using <SequentialGuid/>. For all other platforms, <NewGuid/> is used.

·    This mapping feature can only be applied to read only properties (i.e. can only have a getter).

·    The actual platforms used may place some restrictions of their own.

Examples

The following mapping declaration:

<Type name="NativeIdSample">

  …

  <PrimaryKey>

    <Key>Id</Key>

  </PrimaryKey>

  <Member name="Id"><PersistentField NativeIdGenerator="true"/></Member>

  …

</Type>

                   

Is equivalent to the following in MS SQL:

<Type name="NativeIdSample">

  …

  <PrimaryKey>

    <Key>Id</Key>

  </PrimaryKey>

  <Member name="Id"><PersistentField AutoIncrement="true"/></Member>

  …

</Type>

                   

And is also equivalent to the following in Oracle:

<Type name="NativeIdSample">

  …

  <PrimaryKey>

    <Key>Id</Key>

  </PrimaryKey>

 

  <Member name="Id">

    <PersistentField>

      <Sequence/>

    </PersistentField>

  </Member>

  …

</Type>

Requirements

Editions:Professional, Evaluation, Express

Database Platforms:Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2, IBM DB2

See Also

<PersistentField> Element | Object Identity Generation Strategies



<Sequence> Element <SequentialGuid> Element