I have two tables: Ta and Tb. They have exactly the same table structure but different table names.
I try to create one entity class to map
Create an abstract class (a template class) with annotation @MappedSuperclass then extend it. Each class that extends uses @table, @entity annotations and contains nothing but an empty constructor. All code will be in your parent class. On your methods use generics indicating your parameter entity extends from templateClass and no more code changes are needed. The proper mappings will be in each son you pass.