oracle10g - NHibernate generator for a property value (either from a sequence or autoincrement) -


i have following nhibernate mapping , corresponding class. mapping works fine. want value of field 'rfpid' auto inserted starting '1'.

<?xml version="1.0" encoding="utf-8"?> <hibernate-mapping namespace="ibeam.core.models" assembly="ibeam.core" xmlns="urn:nhibernate-mapping-2.2"> <class name="rfp" table="est_mrfp" schema="test$tran">     <id name="id" type="long">         <generator class="sequence" >             <param name="sequence">test$masters.global_sequence</param>         </generator>     </id>     <property name="rfpid" column="rfpid" type="string" not-null="true" />     <property name="title" column="title" type="string" not-null="true" />   </class> </hibernate-mapping> 

how can this? right have created oracle sequence 'rfpsequence'. , before every new record of type rfp inserted, fetch nextval rfpsequence running query. there way nhibernate can me, id field.

is database responsible increment? if try:-

<property name="rfpid" generated="always" update="false" insert="false" /> 

there caveat nh need perform select straight after insert update value.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -