Announcement Announcement Module
Collapse
No announcement yet.
puzzled prolem about data access of hibernate and spring! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • puzzled prolem about data access of hibernate and spring!

    Hello, everyone,

    I am encoutering a very, very pullzed prolem, I use spring and hibernate together to build an application, and I use "lazy loading" technology, and set opensessionInview configuration in web.xml, looks like the following:

    <filter>
    <filter-name>HibernateSpringFilter</filter-name>
    <filter-class>org.springframework.orm.hibernate.support.Op enSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>HibernateSpringFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    Usually, this problem won't appear, but when this application has been used for a not very long time, it will appear! the following is the exception stack!


    javax.servlet.ServletException: JDBC exception on Hibernate data access: could not load: [com.raykey.services.content.entity.Template#101]; nested exception
    org.apache.struts.action.RequestProcessor.processE xception(RequestProcessor.java:545) org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:486) com.raykey.web.common.SecurityRequestProcessor.pro cessActionPerform(SecurityRequestProcessor.java:37 ) org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274) org.apache.struts.action.ActionServlet.proces


    I think this is the key problem in this question!

    org.springframework.orm.hibernate.HibernateJdbcExc eption: JDBC exception on Hibernate data access: could not load: [com.raykey.services.content.entity.Template#101]; nested exception is java.sql.SQLException: ????? org.springframework.orm.hibernate.SessionFactoryUt ils.convertHibernateAccessException(SessionFactory Utils.java:220) com.raykey.core.db.BaseDao.find(BaseDao.java:151) com.raykey.services

    Anybody has some suggestions about this problem?

  • #2
    I think you need to find out what the SQLException is exactly. Probably there's a connection timeout if you're using a connection pool. In MySQL you can add &reconnect=true to the database connection url.
    If you're using Commons DBCP you can specify a validation query for connections coming from the pool.

    Comment

    Working...
    X