0

Use diferente Hibernate connection

asked 2007-06-20 21:57:28 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4372206

By: cmaniac

Hi all of you

I hope that anybody can help me with this issue. I have my webapp that works perfectly (ZK,+hibernate) but a I have this question, how can I change the hibernate session at runtime so it works with diferent datasource? something like this
escenario:

1X the webapp, initialize with the default connection pool (defined trought hibernate.cfg.xml)....
2X an user attempts to loggin to de webapp... (it enters OK... ) 3X then the webapp MUST to change the hibernate connection so it now point to another datasource with the user/pass of
the user that just logged in.
4X an then and so on... the webapp connects with that datasource

it can be done?.... how I do that?

Hope I explain well!

Thanks

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2007-06-21 07:51:41 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4372693

By: exactt

i did something like that using schemas as offered by postgresql. i made a sessionfactory for each schema. at factory initialization you can set the "hibernate.default_schema" property.

i don't know if this approach is very efficient but you might wanna give it a try...

link publish delete flag offensive edit

answered 2007-06-21 13:41:00 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4373173

By: cmaniac

hi..

well i'm using Oracle 10g, I realize that i have to create a new hibernate session, but how about ZK+hibernate I mean, I have to implement zk + hibernate fix in order to work with the database with no problems (you know all about hibernateutil, zk.xml fix.. etc... etc...).

Or can tell me, how you do it? or enybody else?

- can I make a new hibernate session??

thanks

link publish delete flag offensive edit

answered 2007-07-03 08:36:49 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4393683

By: henrichen

I guess that you have to create a new SessionFactory for a different datasource.
And you have to use the correct SessionFactory to create correct session and so on.

/henri

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-06-20 21:57:28 +0800

Seen: 250 times

Last updated: Jul 03 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More