Why does generated code use deprecated functions?

I have to copy generated code and paste, and then run which produces error of deprecated codes.

Are there best techniques to work around that?