-->
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.  [ 1 post ] 
Author Message
 Post subject: Mysql + Replication
PostPosted: Thu Oct 15, 2009 4:33 pm 
Regular
Regular

Joined: Wed Sep 29, 2004 11:34 am
Posts: 62
Location: Houston, TX
I want Hibernate to make use of the Replication (Master/Slave).

Below is our datasource:
<datasources>
<local-tx-datasource>
<jndi-name>PortalDS</jndi-name>
<connection-url>jdbc:mysql://masterurl:3399,slaveurl:4498/mydb</connection-url>
<driver-class>com.mysql.jdbc.ReplicationDriver</driver-class>
<user-name>system</user-name>
<password>system</password>
<autoReconnect>true</autoReconnect>
<roundRobinLoadBalance>true</roundRobinLoadBalance>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>0</idle-timeout-minutes>
<track-statements/>
</local-tx-datasource>
</datasources>

I am extending on the MySQLInnoDBDialect
Below is my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd" version="1.0">
<persistence-unit name="PortalDS">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/PortalDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="com.at.hib.helpers.ATDialect" />
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.transaction.flush_before_completion" value="true" />
<property name="hibernate.transaction.auto_close_session" value="true" />
<property name="hibernate.cache.use_query_cache" value="true" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
<property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.session_factory_name" value="ATHibernateFactory" />
<property name="hibernate.cache.region_prefix" value=""/>
</properties>
</persistence-unit>
</persistence>

I am seeing the connection created on both the master and the slave. I made a modification on the slave for a table, but when Hibernate queries - it seems to be looking at the master.

What am I missing?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.