You could map it as an int and set the value explicitly using a sql
query.

property = (int)session.CreateSQLQuery("SELECT YOUR_SEQUENCE.NEXTVAL
FROM DUAL").AddScalar("NEXTVAL", NHibernateUtil.Int32).UniqueResult
());

.. and be sure to use transactions.

If you don't want Oracle specific SQL in your C#, put the sql in your
mapping

<sql-query name='SequenceNextValue'>
  <return-scalar column='NEXTVAL' type='System.Int32'/>
    SELECT YOUR_SEQUENCE.NEXTVAL FROM DUAL
</sql-query>

Then call it with:

property = (int)session.GetNamedQuery("SequenceNextValue").UniqueResult
();

What is the purpose of your 'index' column? You might want to look the
Version column instead.
http://nhforge.org/blogs/nhibernate/archive/2009/04/15/nhibernate-mapping-concurrency.aspx

Michael.


On Jul 1, 10:37 am, brulimat <bruli...@gmail.com> wrote:
>  Hi guys!
>
>  I have a question.
>
>  My IDs are GUID but a specific property is an index column.
>  This column uses Oracle´s Sequence.
>  My question is: How to use a Oracle`s Sequence into a property?
>
>  Sorry, but I´m a newbie.
>
>  Thank you.
>
>  Bruno.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to