Hallo Alle!
Ich versuche verzweifelt ein Statement an meine Sybase DB abzuschicken:
Code:
public User getUserByName(String screenName) {
User user = null;
Session lsession = getCurrentSession();
try{
log.info("Trying to login user...");
List users = lsession.createQuery("from User as user where user.inhouseLogin = ?")
.setString(0, screenName)
.list();
Iterator it = users.iterator();
while (it.hasNext()){
user = new User();
user = (User) it.next();
log.info("Obtaining user from DB...");
}
return user;
}
finally{
lsession.close();
}
}
Dabei läuft das ganze beim ausführen der
.list-Anweisung auf den folgenden Fehler:
Code:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1502)
at org.hibernate.loader.Loader.list(Loader.java:1482)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at de.aol.wfm.hibernate.hibernateUtil.user.UserHome.getUserByName(UserHome.java:177)
at de.aol.wfm.services.UserService.doLogin(UserService.java:43)
at de.aol.wfm.services.ServiceLocator.doLogin(ServiceLocator.java:89)
at de.aol.wfm.beanFactory.UserBeanFactory.getUser(UserBeanFactory.java:70)
at de.aol.wfm.beanFactory.UserBeanFactory.createNewBean(UserBeanFactory.java:46)
at de.aol.wfm.beanFactory.Director.constructBean(Director.java:27)
at de.aol.wfm.beanFactory.FactoryFacade.createUserBean(FactoryFacade.java:67)
at de.aol.wfm.bean.UserBean.doLogin(UserBean.java:423)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at de.aol.wfm.filter.SecurityFilter.doFilter(SecurityFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at de.aol.wfm.filter.UebersichtFilter.doFilter(UebersichtFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at de.aol.wfm.filter.SecurityFilter.doFilter(SecurityFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: JZ0S2: Statement wurde bereits geschlossen.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:569)
at com.sybase.jdbc2.jdbc.SybStatement.checkDead(SybStatement.java:1964)
at com.sybase.jdbc2.jdbc.SybStatement.close(SybStatement.java:461)
at com.sybase.jdbc2.jdbc.SybStatement.close(SybStatement.java:449)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.close(NewProxyPreparedStatement.java:1674)
at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:364)
at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:177)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:194)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:123)
at org.hibernate.loader.Loader.doQuery(Loader.java:403)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.doList(Loader.java:1499)
... 61 more
Kann mir jemand sagen, was ich falsch mache? Wie bekomme ich ein Ergebnis aus meiner DB? Vielen Dank!