-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate.cfg.xml without database name in the url
PostPosted: Thu Aug 12, 2010 5:23 pm 
Newbie

Joined: Mon Oct 06, 2008 12:18 pm
Posts: 2
Hi Everybody,

I have a question about my config and the catalog attribute in the hbm.xml files. Currently, I have three databases that I'm accessing simultaneously, so I have three different hibernate config files that have something like this:
<property name="connection.url"> jdbc:oracle:thin:@machineA:some_port:foo</property>
<property name="connection.url"> jdbc:oracle:thin:@machineA:some_port:bar</property>
<property name="connection.url"> jdbc:oracle:thin:@machineA:some_port:foobar</property>

I saw a post that eluded to catalog attribute in the individual hbm.xml files.

viewtopic.php?f=1&t=961448 (The second from the last posting - by jherbst)

My question is could we combine the three configuration files down to one and by pushing the database name down to the in hbm.xml files and have Hibernate figure out which database to go to dynamically? For example:

<property name="connection.url"> jdbc:oracle:thin:@machineA:some_port</property>

In individual hbm.xml files, have something like this:

<class name="a.b.c.d.hibernate.t.t" table="t_name" schema="fooAdmin" catalog="foo">
<class name="a.b.c.d.hibernate.s.s" table="s_name" schema="barAdmin" catalog="bar">
<class name="a.b.c.d.hibernate.u.u" table="u_name" schema="foobarAdmin" catalog="foobar">

Thanks!
Tino


Top
 Profile  
 
 Post subject: Re: Hibernate.cfg.xml without database name in the url
PostPosted: Fri Aug 13, 2010 1:02 am 
Regular
Regular

Joined: Fri Aug 06, 2010 1:49 am
Posts: 102
Location: shynate26@gmail.com
Hello Everybody,

I have few questions to get cleared as I did not have chance to workaround with 2 databases concurrently. Using Oracle 10g.

SID : sidname
user 1 : username-1
user2 : username-2

My queries
    1. From the above what is the catalog name & which is the schema name
    2. I create a table called Persons with username-1 (having 50 records), Now I login in oracle with username-2 If I try creating Persons with username-2 what will happen.

After I get answers for the above I have few other questions to be in place. Please help me understand these things.

_________________

Cheers!
Shynate
mailto:shynate26@gmail.com
www.CSSCORP.com


Top
 Profile  
 
 Post subject: Re: Hibernate.cfg.xml without database name in the url
PostPosted: Mon Aug 16, 2010 4:33 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 8:18 am
Posts: 35
if the user1 give the previlage to access the table then only user2 can access it.
when you retrive the table place user1.tablename.


Top
 Profile  
 
 Post subject: Re: Hibernate.cfg.xml without database name in the url
PostPosted: Mon Aug 16, 2010 4:34 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 8:18 am
Posts: 35
please update,

if you find anything how to access more than one database in single hibernate config files.


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