-->
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: Variable username and password
PostPosted: Thu Apr 10, 2008 6:31 pm 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Hello,

My database has triggers that register what was made by whom and when, for auditing purposes.

Can't find a way for using hibernate.cfg.xml with credentials from different users on each connection to the database. I mean, is there any way to NOT using hardcoded username and password?

Thank you very much.

Hibernate version: 3.2

Name and version of the database you are using: Oracle XE 10


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 9:14 pm 
Beginner
Beginner

Joined: Fri Aug 24, 2007 4:46 am
Posts: 36
Location: Bielefeld / Germany
You'll need to create a SessionFactory for each user with a different database-login and obtain a Session from that SessionFactory. So the usual "store one single SessionFactory as global static variable" won't work for you.

In your case programmatic configuration should be the easiest solution (at least set all credentials via programmatic config whereas all other configs can stay in hibernate.cfg.xml):

http://www.hibernate.org/hib_docs/v3/re ... ation.html

HTH, Maik


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 2:39 am 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 2:40 am 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 2:40 am 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 2:42 am 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 3:14 am 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Sorry! This site was some weird.


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.