Refactor JTA compatibility code