I am using JPA and I need to make the \"tableName\" a variable.
In a database, I have many tables, and my code needs to access the table where I specify it to read.
Specifying the table name at runtime is not possible, this is simply not how JPA works (and I'm still not sure to get your requirement). Either map different entities on your set of tables and run various queries or build them dynamically (maybe using the Criteria API) depending on the input from the client side or use something else than JPA (like iBATIS).