-->
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.  [ 7 posts ] 
Author Message
 Post subject: Restricting access to specific objects at runtime
PostPosted: Wed Feb 15, 2006 11:22 am 
Newbie

Joined: Fri Jan 06, 2006 5:29 pm
Posts: 16
Hibernate version: 3

Hello,

I am trying to develop an application that is useable for multiple clients. However, each client has its own unique tables, and I want to restrict the upper layers of code from making any calls to other client's objects.

Is there a way, at runtime, to specify certain objects as restricted access or "hands-off" to the rest of the code?

I appreciate your help very much!
Thanks!!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 12:54 pm 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
In think filters would be the way to go :
http://www.hibernate.org/hib_docs/v3/reference/en/html/filters.html

Using this you will no prevent queries to be made on other tables but you can simulate empty tables. However this will not prevent inserts, updates.

Alternatively you can use several programmaticaly build a Configuration object and just add the entities you need :
http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html#configuration-programmatic

In fact I think Filters are a bad idea for your problem, I would go the Configuration route.


Top
 Profile  
 
 Post subject: but....
PostPosted: Wed Feb 15, 2006 1:50 pm 
Newbie

Joined: Fri Jan 06, 2006 5:29 pm
Posts: 16
But this still causes me to have to maintain a separate version of the config.hbm.xml file for each client. I am generating (hbm2java) java code at build time, so removing the actual objects out of the configuration would break code that is using those objects, right?

This doesn't seem to be a correct solution....

the-gtm wrote:
In think filters would be the way to go :
http://www.hibernate.org/hib_docs/v3/reference/en/html/filters.html

Using this you will no prevent queries to be made on other tables but you can simulate empty tables. However this will not prevent inserts, updates.

Alternatively you can use several programmaticaly build a Configuration object and just add the entities you need :
http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html#configuration-programmatic

In fact I think Filters are a bad idea for your problem, I would go the Configuration route.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 2:24 pm 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
If you need all entities to be in your config.hbm.xml for hbm2java, then keep using this config.hbm.xml for build time.
Create a second config.hbm.xml for runtime without entities, and in your application add the classes (or .hbm.xml files) you will need to the Configuration.


Top
 Profile  
 
 Post subject: still the same problem
PostPosted: Wed Feb 15, 2006 3:29 pm 
Newbie

Joined: Fri Jan 06, 2006 5:29 pm
Posts: 16
We still have the same problem of maintaining two or more separate config files. I agree these are solutions that work, but I am looking for a more maintainable solution. Something that maybe Hibernate doesn't do at the moment, I don't know.

From a code standpoint, I should be able to specify what objects cannot be accessed in any given JVM. Maybe something related to security? I don't know at this moment.

the-gtm wrote:
If you need all entities to be in your config.hbm.xml for hbm2java, then keep using this config.hbm.xml for build time.
Create a second config.hbm.xml for runtime without entities, and in your application add the classes (or .hbm.xml files) you will need to the Configuration.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 4:55 am 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
Maybe I'm not clear as I'm not a native english speaker :
With this solution you'll get only TWO configurations files to maintain, which is bearable : one with all entities for hbm2java, and one without any entities for runtime.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 2:13 pm 
Newbie

Joined: Fri Jan 06, 2006 5:29 pm
Posts: 16
How do you reference a configuration file from another configuration file? I have decided to keep all the common tables between clients in the main hibernate.cfg.xml file and have the main file point to a "client.cfg.xml" file (containing all client-specific mapping resources) which will be set at build time by ANT.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.