Hi,
We are using the database DB2/400 on OS/400 V5R4, IBM Iseries
Our Schema stucture and application structure is ofcourse tightly coupled as it is a legacy database.
Each user of the application has a specific schema/library specified.
All the DB operations performed/executed by that user should only effect in the specified schema.
We are planning to implement DB persistance using Hibernate3 and we are mandated to follow the same principle of specifying the schema for every user.
Perviously we used to build SQL statments dynamically as following.
String sql = "SELECT * FROM " + library + ".VENDORS";
where the library is a HTTPSession attribute maintained for every user when the user logs in.
I have gone through the documentation and some books on Hibernate regarding the Schema/Library. In that I could only find ways to mention the schema statically in mapping files using the schema attribute in the class entity. This will not cater our specific need on this issue.
I am looking for a way to dynamically mention the schema for a particular Hibernate session, by which I can make sure that all the DB operations are done on that schema objects.
Can anyone please help me out, by suggesting the right way and if not any work arounds on this issue.
Appreciate any help!!!
Thanks & Regards
_________________ Phaneendra Kumar Simhadri
Senior Web Developer
|