I have a mysql database that I want to add the functionality of adding a new table to the database. I could probably easily find the example of the JPQL for this but how would I then automatically generate the entity for this new table so that I could reference it in the rest of my JPA code for updating and deleting from the table I usually reference the entity not the actual table itself.
The Entities I have now I’ve used eclipe to generate from the tables I created. But after deployment we obviously won’t have Eclipse to do this so we need it done automatically every time a table is created.
Creating and mapping new tables dynamically is not something that JPA supports. It would need creating new Java classes on the fly and dynamically update the mapping metadata. You can do everything you want with JDBC or native queries. But maybe you should explain why you need to create new tables on the fly.