Added same improvements to the ORM version
Minor refactor in relational mapping generator