Hi Naveen,
As Rishi mentioned,
you should have TemplateDTO and not String tempID as a member of TemplateUIDTO class. Though you are trying to make that as foreign key, the way you are doing it is wrong.
Replace
with
While saving TemplateUIDTO object, hibernate will take care of the foreign key (using the hbm file mapping). You need not worry on that front.
Regards,
Naresh Waswani