Inserting record into Oracle Database.
I have tried this hbl files in sql server my sql it worked perfectly using identity
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="StockControl.Map.UNIT_TABLE, StockControl" table="UNIT_TABLE" dynamic-update="true">
<id name="ID" column="ID" type="Int32" unsaved-value="0">
<generator class="identity" />
</id>
<property name="UNITDESC" column="UNITDESC" type="String" length="30" unique="true" not-null="true" />
<property name="QTY_CONTAINED" column="QTY_CONTAINED" type="Int32" length="4" />
</class>
</hibernate-mapping
but on trying it in oracle I was only able to read records, to insert record is the problem because of sequence
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="StockControl.Map.UNIT_TABLE, StockControl" table="UNIT_TABLE" dynamic-update="true">
<id name="ID" column="ID" type="Int32" unsaved-value="0">
<generator class="sequence">
<param name="sequence">unittable_sequence</param>
</generator>
</id>
<property name="UNITDESC" column="UNITDESC" type="String" length="30" unique="true" not-null="true" />
<property name="QTY_CONTAINED" column="QTY_CONTAINED" type="Int32" length="4" />
</class>
</hibernate-mapping>
I was able to create tables, sequence automatically in oracle and tables, identity in My sql, Sql server by using Nhibernate method
GenerateSchemaCreationScript();
|