title: Why this Hibernate MySQL Connection is read-only?
body: <p>I have an application using Spring with Hibernate on a MySQL database. For some reason, as of the last few days, anytime I try to persist any objects to my database I am getting the following error: </p>
  
  <blockquote>
    <p>java.sql.SQLException: Connection is read-only. Queries leading to data modification are
    not allowed.<em>*</em></p>
  </blockquote>
  
  <p>I can't for the life of me figure out why this is happening. My application was working fine a few days ago. </p>
  
  <p>I am configuring a SessionFactory object in my applicationContext.xml file like this: </p>
  
  <pre><code>     &lt;bean id="sessionFactory" lass="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
           &lt;property name="configLocation"
   value="classpath:/hibernate.cfg.xml"/&gt;
           &lt;property name="packagesToScan"&gt;
               &lt;list&gt;
                   &lt;value&gt;com.domain.domainObjects&lt;/value&gt;
               &lt;/list&gt;
           &lt;/property&gt;
       &lt;/bean&gt;
  </code></pre>
  
  <p>my hibernate.cfg.xml file looks like this:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:mysql://{url to db}:3306/{db name}&lt;/property&gt;
          &lt;property name="connection.username"&gt;{db user}&lt;/property&gt;
          &lt;property name="connection.password"&gt;{db password}&lt;/property&gt;
          &lt;!-- JDBC connection pool (use the built-in) --&gt;
          &lt;property name="connection.pool_size"&gt;10&lt;/property&gt;
          &lt;!-- SQL dialect --&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt;
          &lt;!-- Enable Hibernate's automatic session context management &gt;
          &lt;property name="current_session_context_class"&gt;thread&lt;/property--&gt;
          &lt;!-- Disable the second-level cache  --&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
          &lt;!-- Echo all executed SQL to stdout --&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;!-- Drop and re-create the database schema on startup --&gt;
          &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I am using a the mysql/j conenction version 5.1, hibernate version 3.2, spring mvc 3.0.5</p>