TblTemplate can be a @MappedSuperclass while for each specific table you have:
Quote:
- tbl_template_1 (id / name) - mapped to entity TblTemplate1
- tbl_template_2 (id / name) - mapped to entity TblTemplate2
- tbl_template_3 (id / name) - mapped to entity TblTemplate3
So, if the TblTemplate contains the id and name fields, the TblTemplate1 does not need to declare any attribute since they inherit them from TblTemplate.
If you're using PostgreSQL, you can even use
table-level inheritance for your design.
Quote:
If I want to create, update, delete data in any table I call that table by table name
You need to use the actual entity type in order to create, update, delete data in a particular table.
Quote:
If using sql would be easier but I would like to use HQL or hibernate builtin functions
You can use HQL as long as you have to make sure you reference the right entity type.