This might be a total newbee question, but I've been searching for hours and can't seem to find anything on this.
Were doing a test project on moving from all Oracle SP to NHibernate.
In our insert_customer(v_firstname, v_lastname, etc.) we use a sequence(CUSTOMER_ID_SEQ) to generate the pk(customer_id).
Problem is:
The sequence is not used directly, its appended a matchcode.
The sequence is also used to set the external_id column if external_id is not supplied.
Per now i have:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="xxx.Core.Domain" assembly="Core">
<class name="Customer" table="CUSTOMER" lazy="false">
<cache usage="read-write"/>
<id name="Id" type="long" column="CUSTOMER_ID" unsaved-value="0">
<generator class="sequence">
<param name="sequence">CUSTOMER_ID_SEQ</param>
</generator>
</id>
<property name="FirstName">
<column name="FIRSTNAME"/>
</property>
<property name="LastName">
<column name="SURNAME"/>
</property>
<property name="Adresse">
<column name="DM_ADDRESS_1"/>
</property> etc etc.
But i cant seem to figure out how to use the sequence to update external_id without generating a new number(obviously wrong) or how to append to the sequence number before inserting.
I'm thinking this can be implemented either by calling a SP or possibly by querying the db for sequence.nextval() and updating the properties before persisting, as .net does not have the Sequence value at the time the sql is generated.
But i was hoping hibernate supplied a more clean solution as mine sort of makes the move to hibernate kinda a mute.