Reputation: 5157
I am creating an Spring Hibernate project where I need to dynamically create tables. The problem is that, with static/ predefined tables, we used to create POJO Entity class for Hibernate SQL table where I already have the table names & their columns.
In current case, I don't know the SQL tables names at development time since they will be created dynamically. So, what is the solution of this problem?
I was searching for the same, I got this link. I still didn't understand the process, i.e. where to create the hibernate-mapping
file, what is the name of the file. In the mapping file also, class name(entity-name) is defined in the example show in the link i.e. Customer
. How it become dynamic?
Upvotes: 1
Views: 501
Reputation: 57381
You can leave table name blank (just don't add @Table annotation) and add Custom Naming Strategy to resolve the table name for the class
Upvotes: 1