i am using hibernate 2.01 and mySql JDBC MySQL Connector/J 3.0.7
it works fine, but after some time stack overflow error is throwing.
here is my code :
public List getArticles(int from, int count, String orderField, boolean ascending, boolean onlyPublished) throws HibernateException {
Session session = null;
try {
session = sf.openSession();
Criteria criteria = session.createCriteria(Article.class);
criteria.setFirstResult(from);
criteria.setMaxResults(count);
if ( ascending )
criteria.addOrder( Order.asc(orderField) );
else
criteria.addOrder( Order.desc(orderField) );
if ( onlyPublished )
criteria.add( Expression.eq("published", new Boolean(true)) );
return criteria.list();
} finally {
if ( session != null )
session.close();
}
}
here is stack trace:
java.lang.StackOverflowError
at java.lang.Class.newInstance2(Native Method)
at java.lang.Class.newInstance1(Class.java(Compiled Code))
at sun.io.Converters.newConverter(Converters.java(Compiled Code))
at sun.io.Converters.newDefaultConverter(Converters.java(Compiled Code))
at java.lang.String.<init>(String.java(Compiled Code))
at java.lang.String.<init>(String.java(Compiled Code))
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code))
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java(Compiled Code))
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java(Compiled Code))
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:1478)
.....
at com.mysql.jdbc.Connection.execSQL(Connection.java:1768)
at com.mysql.jdbc.Connection.rollbackNoChecks(Connection.java:1369)
at com.mysql.jdbc.Connection.rollback(Connection.java:1356)
at com.mysql.jdbc.Connection.close(Connection.java:1028)
at com.mysql.jdbc.Connection.cleanup(Connection.java:2050)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1853)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1787)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1768)
at com.mysql.jdbc.Connection.rollbackNoChecks(Connection.java:1369)
at com.mysql.jdbc.Connection.rollback(Connection.java:1356)
at com.mysql.jdbc.Connection.close(Connection.java:1028)
at com.mysql.jdbc.Connection.cleanup(Connection.java:2050)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1853)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1787)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1768)
at com.mysql.jdbc.Connection.rollbackNoChecks(Connection.java:1369)
at com.mysql.jdbc.Connection.rollback(Connection.java:1356)
at com.mysql.jdbc.Connection.close(Connection.java:1028)
at com.mysql.jdbc.Connection.cleanup(Connection.java:2050)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1853)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:62)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:539)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:140)
at net.sf.hibernate.loader.Loader.find(Loader.java:606)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:81)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3104)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:65)
at ua.com.silverpoint.users.UserManager.getUsers(UserManager.java:116)
at ua.com.silverpoint.users.web.admin.ShowList.execute(ShowList.java:28)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at ua.com.silverpoint.filters.SetEncodingFilter.doFilter(SetEncodingFilter.java:19)
at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:312)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272)
at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
at java.lang.Thread.run(Thread.java:498)
what happens ? maybe someone knows ?
|