You're right that you need to use
addChildStmt.executeUpdate(), that was the cause of the exception.
However, your code can be made much simpler and more performant. Instead of
use
and then erase lines 37 to 52 inclusive in your code. You'll then need to adjust the bind index on line 53 from 2 to 1, of course.
Explanation: the
currVal value will return the value generated by
nextVal in the previous statement. Then you don't need to reread the value generated for parent and don't need to set it in the child. This is how Oracle's sequences are supposed to be used. See also
this documentation
Note that it must all happen in the same transaction, so autocommit must be set to false, but you're already doing it.