Reputation: 1741
I want to create a hibernate mapping to a data-source with dynamic tablenames. The tables reflect datasets extracted from another source by a legacy tool, and the tablename itself carries meta-information about the data in the table. The tablename would change for every request.
Is it possible to map this in hibernate? I'm thinking some temporary interceptor thing to change the table name, but cant really wrap my head around the best way to do this.
edited 12/07/12
..and i probably should have mentioned that readonly access is all i need. The tables represents "report" data, hence should never be changed.
Upvotes: 0
Views: 305
Reputation: 30803
dynamic table names are not so easy with hibernate because the sessionfactory is immutable. You would need to Build up a new sessionfactory everytime. Depending on the use case i see several options:
Upvotes: 1