-->
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: Setting search_path in PostgreSQL
PostPosted: Wed Jun 27, 2007 1:21 am 
Newbie

Joined: Wed Jun 27, 2007 1:10 am
Posts: 12
I'm creating a Hibernate mapping for a view named foo_view in a PostgreSQL DB. The configuration is like this:

The DB is on a remote server and can only be accessed using a SSH tunnel. Normally, I will first create a SSH tunnel from my localhost to the DB host. Then I'll just psql my localhost.

One problem is: I'll have to do:

Code:
SET search_path = foo, bar;


everytime in my psql shell to be able to access foo_view. I don't know where to set this runtime parameter in Hibernate. Can anyone shed some light on this?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 28, 2007 2:09 am 
Newbie

Joined: Wed Jun 27, 2007 1:10 am
Posts: 12
Ok, I did my own research and the solution is actually quite simple. Solution: refer to the view/table by its full name (including schema name). Say if you have a view/table named "bar", first find out which schema it resides in by
Code:
\d bar
which actually tells you the full name of the table, like
Code:
View "foo.bar"
. This means table bar is in schema foo. In hibernate mapping file, refer to the table as foo.bar instead of just bar.


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.