-->
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: Hibernate and ReplicationDriver
PostPosted: Mon Jul 20, 2009 2:43 pm 
Newbie

Joined: Mon Jul 20, 2009 12:45 pm
Posts: 2
I have a master/slave MySQL replication setup. I want all writes to be sent to the master, and all reads to the slave.

I change the jdbc driver to com.mysql.jdbc.ReplicationDriver with the url set to jdbc:mysql://master,slave/db,

The mysql docs for ReplicationDriver say that as soon as setReadOnly(false) is called, all further queries are passed to the master, if setReadOnly(true) is called, all further queries are passed to the slave.

I did some test, first, I try to get connection directly from DBCP Connection Pool, no Hibernate, both reading and writing work well.

after that, I tried to use Hibernate3.3, all updates work fine (passed to the master), but all reading sent to the master too (It should be passed to Slave), that's weird.

I tried session.connection().setReadOnly(true) and query.setReadOnly(true), both don't work.

Does Hibernate support ReplicationDriver?


Top
 Profile  
 
 Post subject: Re: Hibernate and ReplicationDriver
PostPosted: Tue Jul 21, 2009 7:26 pm 
Newbie

Joined: Mon Jul 20, 2009 12:45 pm
Posts: 2
It has been fixed.

because there are conflict in jars.


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.