Waqar Sadiq
2011-08-05 23:56:48 UTC
Hi,
I am using nHibernate 2.1.2 with Oracle. I have a need to get an
Oracle sequence. I researched on the internet and got eht following
mapping example.
<sql-query name="GetSequence" read-only="true">
<return-scalar column="a" type="Int64"/>
<![CDATA[select SEQ_IDGENERATOR.NextVal from dual]]>
</sql-query>
My C# code that uses it is something like this.
long nextSeq =
Session.GetNamedQuery("GetSequence").UniqueResult<Int64>();
The problem is that when I have a value for the column, I get an
error:
InnerException: System.IndexOutOfRangeException
Message=Unable to find specified column in result set
Source=Oracle.DataAccess
When I do no tprovide any value for column, the I get the following
error:
Message=A valid scalar alias must be specified.
Parameter name: alias
Source=NHibernate
If I leave out column completely, I get the following error:
InnerException: NHibernate.MappingException
Message=(19,6): XML validation error: The required attribute
'column' is missing.
Source=NHibernate
Since in this query, I am not querying a table, I am not sure what is
the significance o fthe column field and what to provide here.
Any help is appreciated.
Thanks,
Waqar
I am using nHibernate 2.1.2 with Oracle. I have a need to get an
Oracle sequence. I researched on the internet and got eht following
mapping example.
<sql-query name="GetSequence" read-only="true">
<return-scalar column="a" type="Int64"/>
<![CDATA[select SEQ_IDGENERATOR.NextVal from dual]]>
</sql-query>
My C# code that uses it is something like this.
long nextSeq =
Session.GetNamedQuery("GetSequence").UniqueResult<Int64>();
The problem is that when I have a value for the column, I get an
error:
InnerException: System.IndexOutOfRangeException
Message=Unable to find specified column in result set
Source=Oracle.DataAccess
When I do no tprovide any value for column, the I get the following
error:
Message=A valid scalar alias must be specified.
Parameter name: alias
Source=NHibernate
If I leave out column completely, I get the following error:
InnerException: NHibernate.MappingException
Message=(19,6): XML validation error: The required attribute
'column' is missing.
Source=NHibernate
Since in this query, I am not querying a table, I am not sure what is
the significance o fthe column field and what to provide here.
Any help is appreciated.
Thanks,
Waqar
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhusers-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to nhusers+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhusers-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to nhusers+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.