In the mapping file for a persistent class, the table attribute specifies the name of the database table to store data. With Hibernate, there are a few things that can be configured at runtime. Can the table name be configured in code rather than in the XML configuration file?
I want to persist user records to a table specific to the user, rather than a generic table for all records. For example, records for user #145 will be stored in dbo.145_user_record and records for user #456 will be stored in dbo.456_user_record.
Haven't figure out if this is possible with Hibernate. Any help is greatly appreciated.
Where does your #145 or blah.... values are coming... are these also dynamically generated or user defined?
When a user registers with the application they are assigned an ID number. The ID number is generated by the application. When a user registers, a set of tables will be created in the database (for expense records, transactions, sales data, etc.)
Thanks for sending the link. I will check it out when I get a chance and see what it do
After a few discussions about this, I think this would require a newly configured SessionFactory, if it were to work. Currently, the SessionFactory is configured with the data in the configuration file when application is deployed. We need a dynamic SessionFactory which is configured at runtime in the code using runtime values. It seems possible, not sure if with the current verison of Hibernate. Maybe a future enhancement. [ June 11, 2008: Message edited by: James Clark ]