-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping Databases
PostPosted: Thu Dec 13, 2007 12:01 am 
Newbie

Joined: Wed Dec 12, 2007 11:56 pm
Posts: 2
Location: Brasil
Can I use more than one database at the same time?

For exemple, my hibernate.cfg.xml below:

<hibernate-configuration>

<session-factory name="MySQL">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/seb</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">passw</property>

<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>

<property name="c3p0.min_size">20</property>
<property name="c3p0.max_size">75</property>
<property name="c3p0.timeout">180</property>
<property name="c3p0.maxIdletime">300</property>
<property name="c3p0.idle_test_period">100</property>
<property name="c3p0.max_statements">0</property>

<mapping class="br.com.schneider.sistemas.modelo.Usuario" />

</session-factory>

<session-factory name="Oracle">
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost/mydatabase</property>

<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">paswd</property>

<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>

<property name="c3p0.min_size">20</property>
<property name="c3p0.max_size">75</property>
<property name="c3p0.timeout">180</property>
<property name="c3p0.maxIdletime">300</property>
<property name="c3p0.idle_test_period">100</property>
<property name="c3p0.max_statements">0</property>
</session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 5:48 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

sure you can.


please see this

http://forum.hibernate.org/viewtopic.ph ... 28#2360128

Amila

(Don't forget to rate if helps)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 7:33 pm 
Newbie

Joined: Wed Dec 12, 2007 11:56 pm
Posts: 2
Location: Brasil
Hi Amila,

Ok, but in my exemple I'll use two differents database, Postgree and MySQL. How the Hibernate will know persist the correct class at the correct database?

Thanks!!


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