Actually, there is an easier method if you don't need the ORM functions:
http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/index.html
Doctrine ORM works on top of Doctrine DBAL, so, in theory, you should be able to use it inside X-Cart 5 code too. However, I never tried this, and can't find examples in the source code of X-Cart 5.