Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I'm trying to implement a search using Ajax, which updates the resultset as the user types ( similar to google beta ). However when typing I suddenly get this exception, how can I have multiple transactions at the same time? I'm using HibernateFilterLong and have set the caching to READ_WRITE on some of the objects. I'm planning on restricting the update interval as to maybe 1-2s, but I still think that the server must be able to cope with a faster interval without giving me this exception.
regards
/Magnus Sjöstrand
Hibernate version:
3.1rc2
Annoations 3.1b5
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
INFO: Multiply prepared statement! select count(*) as y0_ from Users this_ inner join usergroup groups3_ on this_.id=groups3_.userId inner join Groups group1_ on groups3_.groupId=group1_.id where this_.login ilike ? and this_.id<>? and group1_.name=?
Hibernate: select this_.id as id14_12_, this_.login as login14_12_, this_.salt as salt14_12_, this_.password as password14_12_, this_.firstname as firstname14_12_, this_.lastname as lastname14_12_, this_.email as email14_12_, this_.smsNumber as smsNumber14_12_, this_.presentation as presenta9_14_12_, this_.likes as likes14_12_, this_.dislikes as dislikes14_12_, this_.emailConfirmed as emailCo12_14_12_, this_.countryId as countryId14_12_, this_.stateId as stateId14_12_, this_.countyId as countyId14_12_, this_.ismale as ismale14_12_, this_.dateOfBirth as dateOfB14_14_12_, this_.allowSms as allowSms14_12_, this_.autoConfirmContacts as autoCon16_14_12_, this_.emailVisible as emailVi17_14_12_, country3_.id as id1_0_, country3_.labelid as labelid1_0_, country3_.iso as iso1_0_, label4_.id as id8_1_, label4_.name as name8_1_, values5_.labelid as labelid14_, values5_.id as id14_, values5_.languageId as languageId14_, values5_.id as id9_2_, values5_.labelid as labelid9_2_, values5_.languageId as languageId9_2_, values5_.value as value9_2_, language6_.id as id10_3_, language6_.labelid as labelid10_3_, language6_.iso as iso10_3_, label7_.id as id8_4_, label7_.name as name8_4_, state8_.id as id13_5_, state8_.labelid as labelid13_5_, state8_.countryId as countryId13_5_, label9_.id as id8_6_, label9_.name as name8_6_, country10_.id as id1_7_, country10_.labelid as labelid1_7_, country10_.iso as iso1_7_, county11_.id as id2_8_, county11_.labelid as labelid2_8_, county11_.stateId as stateId2_8_, label12_.id as id8_9_, label12_.name as name8_9_, state13_.id as id13_10_, state13_.labelid as labelid13_10_, state13_.countryId as countryId13_10_, groups14_.userId as userId, group1_.id as groupId, group1_.id as id7_11_, group1_.name as name7_11_ from Users this_ left outer join Country country3_ on this_.countryId=country3_.id left outer join Label label4_ on country3_.labelid=label4_.id left outer join LabelValue values5_ on label4_.id=values5_.labelid left outer join Language language6_ on values5_.languageId=language6_.id left outer join Label label7_ on language6_.labelid=label7_.id left outer join State state8_ on this_.stateId=state8_.id left outer join Label label9_ on state8_.labelid=label9_.id left outer join Country country10_ on state8_.countryId=country10_.id left outer join County county11_ on this_.countyId=county11_.id left outer join Label label12_ on county11_.labelid=label12_.id left outer join State state13_ on county11_.stateId=state13_.id inner join usergroup groups14_ on this_.id=groups14_.userId inner join Groups group1_ on groups14_.groupId=group1_.id where this_.login ilike ? and this_.id<>? and group1_.name=? order by this_.login asc limit ?
21-Nov-2005 11:11:54 org.apache.struts.action.RequestProcessor processException
WARNING: Unhandled Exception thrown: class org.hibernate.HibernateException
21-Nov-2005 11:11:54 com.snusk.HibernateFilterLong doFilter
SEVERE: Could not rollback transaction after exception!
org.hibernate.TransactionException: Transaction not successfully started
at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:149)
at com.snusk.HibernateFilterLong.doFilter(HibernateFilterLong.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
21-Nov-2005 11:11:54 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
org.hibernate.HibernateException: createCriteria is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:268)
at $Proxy36.createCriteria(Unknown Source)
at com.snusk.data.UserDAO.createSearchQuery(UserDAO.java:149)
at com.snusk.data.UserDAO.search(UserDAO.java:31)
at com.snusk.ContactsAction.searchResult(ContactsAction.java:153)
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:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.snusk.EncodingFilter.doFilter(EncodingFilter.java:20)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.snusk.HibernateFilterLong.doFilter(HibernateFilterLong.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Name and version of the database you are using:
Postgresql 8.0
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: