-->
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.  [ 2 posts ] 
Author Message
 Post subject: Set up Oracle Role with Hibernate
PostPosted: Tue Feb 28, 2012 1:54 pm 
Newbie

Joined: Tue Feb 28, 2012 1:34 pm
Posts: 1
Hi...

When a new connection with DB is created, I need to execute the command "SET ROLE XXX IDENTIFIED BY XXX;".
The DB user only have privs to create session. All grants (select, insert, update, delete) come from role.
How can I do that??

My project use Hibernate with Jboss 7.1.

Sorry about my English.


Top
 Profile  
 
 Post subject: Re: Set up Oracle Role with Hibernate
PostPosted: Thu Mar 01, 2012 3:12 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi Avallon,

which connection-pool implementation are you using?
Most connection-pool implementations provide the possibility to specify a initSqls or a testQuery
whcih should be executed when establishing a new connection.
If you are using c3p0 for example, then you can define

<property name="hibernate.c3p0.testConnectionOnCheckout" value="true"/>
Code:
    <property name="hibernate.c3p0.preferredTestQuery" value="SET ROLE XXX IDENTIFIED BY XXX;select 1 from dual;"/>


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