Grails can not assigning sequence next value to a field using SQL Server database

96 Views Asked by At

I am using grails 2.5.2 and SQL Server database. I have created a sequence in my table sp_support_ticket named TICKET_SEQ. In my domain I am trying to map that sequence as follow:

static mapping = {
    table 'sp_support_ticket'
    ticketSequence generator:'sequence', params:[sequence:'TICKET_SEQ']
    ...
}

And my TICKET_SEQ looks as below:

enter image description here

But when I try to save the domain object, null value inserted in the field ticket_sequence. My question is how to set the next value of sequence in the field ticketSequence or will it take it automatically during save?

NOTE: I am not using native SQL or HQL

0

There are 0 best solutions below