Hello there im trying to use this query on Hibernate 3.6.8 with Spring:
@Override public List searchProducto(final String claves,final Integer pagina, final Integer nroFilas) { return getHibernateTemplate().executeFind(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { String sql = "SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY RANK DESC) AS RowNr, * FROM vista_web_productos AS vwp INNER JOIN FREETEXTTABLE( producto,clave,:name) as ftt ON ftt.[KEY]=vwp.id_web) t WHERE RowNr BETWEEN :inicio AND :fin"; SQLQuery query = (SQLQuery) session.createSQLQuery(sql); query.addEntity(VistaWebProductoVO.class).setString("name",claves).setInteger("inicio", ((pagina - 1) * nroFilas)+1 ).setInteger("fin", ((pagina) * nroFilas) ); List list = query.list(); return list; } }); }
Whe i test this code, sometimes it works and sometimes it doesnt. But when I compile my project the test always fail giving me a :java.net.SocketException: Connection reset by peer: socket write error. This is the stack error:
------------------------------------------------------------------------------- Test set: TestSuite ------------------------------------------------------------------------------- Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.212 sec <<< FAILURE! pruebaDataAccess(pe.com.estilos.portal.dataaccess.VistaWebTest) Time elapsed: 0.708 sec <<< FAILURE! org.springframework.dao.DataAccessResourceFailureException: could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:629) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343) at pe.com.estilos.portal.dataaccess.domain.hibernate.HibernateVistaWebProductoDAO.searchProducto(HibernateVistaWebProductoDAO.java:249) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) at $Proxy27.searchProducto(Unknown Source) at pe.com.estilos.portal.dataaccess.VistaWebTest.pruebaDataAccess(VistaWebTest.java:38) Caused by: org.hibernate.exception.JDBCConnectionException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.loader.Loader.doList(Loader.java:2545) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276) at org.hibernate.loader.Loader.list(Loader.java:2271) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157) at pe.com.estilos.portal.dataaccess.domain.hibernate.HibernateVistaWebProductoDAO$1.doInHibernate(HibernateVistaWebProductoDAO.java:254) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ... 42 more Caused by: java.sql.SQLException: I/O Error: Connection reset by peer: socket write error at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1053) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:465) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:776) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate.loader.Loader.getResultSet(Loader.java:1953) at org.hibernate.loader.Loader.doQuery(Loader.java:802) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) at org.hibernate.loader.Loader.doList(Loader.java:2542) ... 50 more Caused by: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.DataOutputStream.write(DataOutputStream.java:90) at net.sourceforge.jtds.jdbc.SharedSocket.sendNetPacket(SharedSocket.java:676) at net.sourceforge.jtds.jdbc.RequestStream.putPacket(RequestStream.java:560) at net.sourceforge.jtds.jdbc.RequestStream.flush(RequestStream.java:508) at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1040) ... 57 more
Any ideas of what is happening?
|