views:

1199

answers:

2

I'm trying to insert some new objects into a firebird database using NHibernate.

I get the error "could not get next sequence value[SQL: SQL not available]"

Here is the mapping I'm using at present. Note ANML_EVNT is the name of the generator I want to use.

 <id name="Id" column="ID" type="integer">
  <generator class="sequence">
   <param name="sequence">ANML_EVNT></param> 
  </generator>


 </id>
+1  A: 

That looks all right. The problem is not the end bracket after ANML_EVNT, right?

 <id name="Id" column="ID" type="integer">
      <generator class="sequence">
          <param name="sequence">ANML_EVNT</param>       
      </generator>


</id>
gcores
I'm not really sure what you mean ... do you have a suggestion for another way I could try?
tjjjohnson
In your example there is an extra bracket after ANML_EVNT @gcores has removed it
Bramha Ghosh
+2  A: 

If you still are looking for an answer here is how I've used it successfully.

I use the "native" generator because when adding support for SQL Server to our program the only thing in NHibernate I had to change was the generator types to "native" because Firebird and SQL Server implement their "auto incrementing identity" columns differently. In Firebird it used the named generator and in SQL Server it ignores the "sequence" parameter and uses the auto-increment built in.

Here's the example of what I'm talking about:

<id name="Id" column="ID">
   <generator class="native">
      <param name="sequence">ANML_EVNT</param>
   </generator>
</id>

With all that said, as gcores answered, all that appears to be wrong with your config is the extra ">" after ANML_EVNT.

Mark G