Error "java.sql.SQLException: Incorrect string value: \ xE7 \ xF5 for column"

1

Good afternoon,

I'm having the error below whenever I try to perform an indexing method.

ERROR:

javax.servlet.ServletException: net.alforria.util.InfraException: net.sf.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
    org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    net.alforria.b2c.web.UrlRewriteFilter.comitaPaginaUrlAmigavel(UrlRewriteFilter.java:129)
    net.alforria.b2c.web.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:91)
root cause

net.alforria.util.InfraException: net.sf.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
    net.alforria.b2c.dao.BaseDAO.findByQuery(BaseDAO.java:149)
    net.alforria.b2c.dao.ProdutoDAO.findSecoesByProduto(ProdutoDAO.java:454)
    net.alforria.b2c.modelo.Produto.atualizaBusca(Produto.java:999)
    net.alforria.b2c.loja.produto.ProdutoAction.iniciaIndexacao(ProdutoAction.java:1437)
    net.alforria.b2c.loja.produto.ProdutoAction.view(ProdutoAction.java:1467)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
    org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    net.alforria.b2c.web.UrlRewriteFilter.comitaPaginaUrlAmigavel(UrlRewriteFilter.java:129)
    net.alforria.b2c.web.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:91)
root cause

net.sf.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
    net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:90)
    net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:79)
    net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
    net.sf.hibernate.impl.BatcherImpl.convert(BatcherImpl.java:328)
    net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:135)
    net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
    net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
    net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1821)
    net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1578)
    net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
    net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
    net.alforria.b2c.dao.BaseDAO.findByQuery(BaseDAO.java:145)
    net.alforria.b2c.dao.ProdutoDAO.findSecoesByProduto(ProdutoDAO.java:454)
    net.alforria.b2c.modelo.Produto.atualizaBusca(Produto.java:999)
    net.alforria.b2c.loja.produto.ProdutoAction.iniciaIndexacao(ProdutoAction.java:1437)
    net.alforria.b2c.loja.produto.ProdutoAction.view(ProdutoAction.java:1467)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
    org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    net.alforria.b2c.web.UrlRewriteFilter.comitaPaginaUrlAmigavel(UrlRewriteFilter.java:129)
    net.alforria.b2c.web.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:91)
root cause

java.sql.BatchUpdateException: Incorrect string value: '\xE7\xF5es d...' for column 'DESC_LONGA' at row 1
    com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024)
    com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
    org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
    net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128)
    net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
    net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
    net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1821)
    net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1578)
    net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
    net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
    net.alforria.b2c.dao.BaseDAO.findByQuery(BaseDAO.java:145)
    net.alforria.b2c.dao.ProdutoDAO.findSecoesByProduto(ProdutoDAO.java:454)
    net.alforria.b2c.modelo.Produto.atualizaBusca(Produto.java:999)
    net.alforria.b2c.loja.produto.ProdutoAction.iniciaIndexacao(ProdutoAction.java:1437)
    net.alforria.b2c.loja.produto.ProdutoAction.view(ProdutoAction.java:1467)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
    org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    net.alforria.b2c.web.UrlRewriteFilter.comitaPaginaUrlAmigavel(UrlRewriteFilter.java:129)
    net.alforria.b2c.web.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:91)
root cause

java.sql.SQLException: Incorrect string value: '\xE7\xF5es d...' for column 'DESC_LONGA' at row 1
    com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
    com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
    com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
    com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
    com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
    com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1976)
    com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
    org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
    net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128)
    net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
    net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
    net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1821)
    net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1578)
    net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
    net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
    net.alforria.b2c.dao.BaseDAO.findByQuery(BaseDAO.java:145)
    net.alforria.b2c.dao.ProdutoDAO.findSecoesByProduto(ProdutoDAO.java:454)
    net.alforria.b2c.modelo.Produto.atualizaBusca(Produto.java:999)
    net.alforria.b2c.loja.produto.ProdutoAction.iniciaIndexacao(ProdutoAction.java:1437)
    net.alforria.b2c.loja.produto.ProdutoAction.view(ProdutoAction.java:1467)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
    org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    net.alforria.b2c.web.UrlRewriteFilter.comitaPaginaUrlAmigavel(UrlRewriteFilter.java:129)
    net.alforria.b2c.web.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:91)

The methods that query the database are as follows:

FINDSECOESBYPRODUCT

public List findSecoesByProduto(long idLoja, long idProduto) {
    List ret;
    Session s = HibernateUtil.getSession();
    SimpleHqlBuilder query = new SimpleHqlBuilder("select s from Secao as s left join s.prdSet ps");
    query.and("ps.id = ?"       , idProduto);
    query.and("s.idLoja = ?"    , idLoja   );
    query.and("s.habilitada = ?", 1        );
    return findByQuery(query.getHql(), query.getParams());
}

FINDBYQUERY

protected final List findByQuery(String hql, Object... paramValues) {
    List ret;
    Session s = HibernateUtil.getSession();

    try {
        Query query = s.createQuery(hql);

        if(paramValues != null) {
            int i = 0;
            for (Object paramValue: paramValues) {
                query.setParameter(i++, paramValue);
            }
        }

        ret = query.list();
    }
    catch(HibernateException e) {
        log.error("Error executing query (" + hql + ").", e);
        throw new InfraException(e);
    }

    return ret;
}

We use these same methods on other servers where mysql's Collate is always set to latin1_swedish_ci , we try to change some configures like character_set from mySql and nd ...

Does anyone know what might be the cause of this error?

    
asked by anonymous 02.06.2015 / 19:15

0 answers