Hello everyone
I'm facing a very strange problem right now.
I have a bidiretional association, with a one-to-many relationship with a Joined Subclass inherited table. And it's throwing the exception when I try to detail a row in the datatable. The strange part is that with HSQLDB it works like a charm, both with embeeded database and with remote database, but it miserabily fails in MySQL 5, both with MySQLInnoDBDialect or MySQL5Dialect.
Thanks in advance
Rafael Mauricio Nami
Hibernate version:
Hibernate 3.1
Hibernate annotations beta 3
Spring 1.2.7
mysql-connector-java-5.0.3
Mapping documents:
Code:
Pessoa.java
// Atributo responsável pelos telefones de uma pessoa.
private List<Telefone> telefones = new ArrayList<Telefone>();
// Atributo responsável pelos endereços de uma pessoa.
private List<Logradouro> enderecos = new ArrayList<Logradouro>();
/**
* @return Returns the enderecos.
*/
@OneToMany(targetEntity = Logradouro.class, mappedBy = "pessoa",fetch=FetchType.LAZY)
@IndexColumn(name="INDEX_PESSOA_ENDERECOS")
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_RE AD_WRITE)
public List<Logradouro> getEnderecos() {
return enderecos;
}
/**
* @return Returns the telefones.
*/
@OneToMany(targetEntity = Telefone.class, mappedBy = "pessoa",fetch=FetchType.LAZY)
@IndexColumn(name="INDEX_PESSOA_TELEFONES")
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_RE AD_WRITE)
public List<Telefone> getTelefones() {
return telefones;
}
Code:
Telefone.class
/**
* @return the pessoa
*/
@ManyToOne
public Pessoa getPessoa() {
return pessoa;
}
Code:
Logradouro.class
/**
* @return the pessoa
*/
@ManyToOne
public Pessoa getPessoa() {
return pessoa;
}
Full stack trace of any exception that occurs:
11/09/2006 23:19:23 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: S1009
11/09/2006 23:19:23 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Connection is read-only. Queries leading to data modification are not allowed
11/09/2006 23:19:23 org.hibernate.event.def.AbstractFlushingEventListe ner performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledN onSpecificException(SQLStateConverter.java:91)
...
11/09/2006 23:19:23 org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.faces.el.EvaluationException: Cannot get value for expression '#{paisWebBean.comboPaises}'
at org.apache.myfaces.el.ValueBindingImpl.getValue(Va lueBindingImpl.java:397)
...
Caused by: javax.faces.el.EvaluationException: com.lucassoftwares.webbeans.localidade.PaisWebBean
at org.apache.myfaces.el.PropertyResolverImpl.getValu e(PropertyResolverImpl.java:78)
... 62 more
Caused by: javax.faces.el.EvaluationException: Bean: com.lucassoftwares.webbeans.localidade.PaisWebBean , property: comboPaises
at org.apache.myfaces.el.PropertyResolverImpl.getProp erty(PropertyResolverImpl.java:404)
...
Caused by: org.springframework.jdbc.UncategorizedSQLException : Hibernate operation: Could not execute JDBC batch update; uncategorized SQLException for SQL [update Estado set CD_PAIS=?, nome=?, dataAlteracao=?, dataCadastro=?, sigla=? where cd_estado=?]; SQL state [S1009]; error code [0]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
at org.springframework.jdbc.support.SQLStateSQLExcept ionTranslator.translate(SQLStateSQLExceptionTransl ator.java:96)
...
Caused by: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:910)
at com.mysql.jdbc.ServerPreparedStatement.executeBatc h(ServerPreparedStatement.java:547)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch( BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(Ab stractBatcher.java:195)
at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:230)
at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListe ner.performExecutions(AbstractFlushingEventListene r.java:296)
at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:1009)
at org.hibernate.impl.SessionImpl.managedFlush(Sessio nImpl.java:356)
at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:106)
at org.springframework.orm.hibernate3.HibernateTransa ctionManager.doCommit(HibernateTransactionManager. java:584)
... 79 more
11/09/2006 23:19:23 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Cannot get value for expression '#{paisWebBean.comboPaises}'
at org.apache.myfaces.context.servlet.ServletExternal ContextImpl.dispatch(ServletExternalContextImpl.ja va:421)
at org.apache.myfaces.application.jsp.JspViewHandlerI mpl.renderView(JspViewHandlerImpl.java:234)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderVi ew(ViewHandlerWrapper.java:101)
at org.apache.myfaces.lifecycle.LifecycleImpl.render( LifecycleImpl.java:352)
at javax.faces.webapp.FacesServlet.service(FacesServl et.java:107)
at at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.jasper.JasperException: Cannot get value for expression '#{paisWebBean.comboPaises}'
at org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:510)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.myfaces.context.servlet.ServletExternal ContextImpl.dispatch(ServletExternalContextImpl.ja va:415)
... 35 more
Name and version of the database you are using:
MySQL 5
The generated SQL (show_sql=true):
Hibernate: select estados0_.CD_PAIS as CD6_1_, estados0_.cd_estado as cd1_1_, estados0_.cd_estado as cd1_1_0_, estados0_.CD_PAIS as CD6_1_0_, estados0_.nome as nome1_0_, estados0_.dataAlteracao as dataAlte3_1_0_, estados0_.dataCadastro as dataCada4_1_0_, estados0_.sigla as sigla1_0_ from Estado estados0_ where estados0_.CD_PAIS=?
Hibernate: update Estado set CD_PAIS=?, nome=?, dataAlteracao=?, dataCadastro=?, sigla=? where cd_estado=?