-->
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: Multiple Schema + Hibernate
PostPosted: Wed Jul 27, 2005 7:36 am 
Newbie

Joined: Mon Jan 31, 2005 11:33 am
Posts: 8
Location: Netherlands
In our application we want have schema on DataBase which depends upon the user logging in (user chooses)...

How can Hibernate at runtime be directed to choose different Data Source..I am using hibernate.cfg.xml for configuration !!

Thanks
Andy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 9:53 am 
Newbie

Joined: Wed Jul 13, 2005 7:00 pm
Posts: 9
Have a SessionFactory for each Database Schema. And based on the runtime condition (login in your case), you can decide on which SessionFactory to use to get your session.

If you are using the HibernateSession utility class with one session per thread one static sessionfactory, you can have one sessionfactory for schema and getSession can check the login condition.

There could be some better ways of doing this and maybe some sample utility classes somewhere...
[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 10:13 am 
Newbie

Joined: Wed Jul 13, 2005 7:00 pm
Posts: 9
rmutyala wrote:

If you are using the HibernateSession utility class with one session per thread one static sessionfactory, you can have one sessionfactory for schema and getSession can check the login condition.



well.. some typos here.. i was referring to the HibernateUtil class in http://www.hibernate.org/42.html when I meant HibernateSession utility class. and read it as one static SessionFactory per schema, one threadlocal session and threadlocal transaction per schema and let the getSession() method return the Session based on the runtime condition.

Hope this helps.


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.