-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How do we specify the DB2/400 schema name in HQL dynamically
PostPosted: Fri Apr 14, 2006 11:24 am 
Newbie

Joined: Fri Apr 14, 2006 11:03 am
Posts: 6
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


Top
 Profile  
 
 Post subject: Help me out!!!
PostPosted: Mon Apr 17, 2006 2:25 pm 
Newbie

Joined: Fri Apr 14, 2006 11:03 am
Posts: 6
Hi,

Can dynamic schema name can be set to all the HQL statements for a particular user. if yes, how????

Thanks & Regards,

_________________
Phaneendra Kumar Simhadri
Senior Web Developer


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 24, 2006 6:22 pm 
Newbie

Joined: Tue Oct 24, 2006 6:05 pm
Posts: 2
I noticed this post is similar to post

http://forum.hibernate.org/viewtopic.ph ... ht=iseries

I am facing a similar situation where the same table name exists in different libraries. For example, table company will exist in mcparm, peparm, and myparm library. Based on what the company ID is what determines which library to read.

Company 1
Select name from mcparm.company
Company 2
Select name from peparm.company

Can anyone point me in the right direction as to how to map this? Do I need to map each table in each library?

I'm using Hibernate 3.1.

Any help would be great!! Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.