Search code examples
springoracle11gibatis

Ibatis Oracle sequence number issue with Spring


I have a Spring based Application connecting to Oracle database using ibatis.

I need to write records into the database and I want to use the db sequence for the primary key of the table. I am not able to call the next value of the sequence from Spring classes. Please suggest me if this is feasible. If not please suggest me some alternate approach of writing the primary key of the table. Please suggest if possible with an example.

Thanks in advance.


Solution

  • It done now.

    It can be done using annotation as @SelectKey(statement="select id.nextval from dual", keyproperty="id", before=true , resultType="long.class")