I've many tables during my DB with the identical structure: same posts names and kinds. The only real distinction between these tables may be the their names (that we are only able to know in runtime).

I must produce a mapping of the class to some table but giving the title on the table only throughout runtime (no static @Table annotation).

Is it feasible? Can there be every other method to achieve transpire?

Directly - no. Since this is not really a regular use-situation. Normally you shouldn't have dynamcally-produced tables. It's a valid use whenever you move some records for an archive table (or tables), but otherwise cure it.

Anyway, you may make that actually work: create a native query, and map the end result for your non-entity object. You'll have the ability to choose from the table and transform the end result for an object. However, you cannot place or update this way.

Don't believe associating or altering the table planned for an entity dynamically can be done.

You should check @MappedSuperClass, which will help you to define all fields inside a class once and inherit them, to ensure that there's no repetition and organizations are empty class with mappings.


Knowing the table title dynamically you could instantiate the planned class accordingly.