There is an existing code in my project it calls the mysql
function. mysql
function updates the value in a table.
function next_val (input varchar(10))
returns decimal(5,0)
begin
update table set val = (@next_val := next_val) + inc where name = input;
return @next_val;
end
In Spring code, I call the function using javax.entitymanager
em.createNativeQuery("select next_val('DB') from dual");
I am invoking the above method using @transactional
annotation but this call auto commits the function result.
I couldn't revoke on any error