Why do I get this, where is the subquery???
I use SQL server 2000, HIBERNATE 2,1,7
userId is of type String and type is Integer
HibernateTemplate template = ServiceLocator.instance().newHibernateTemplate();
List l = template.find(
"from Report report where report.userId = ? and report.reportType = ? and report.signed = false",
new Object[]{userId, type});
10:18:10,011 INFO [STDOUT] Hibernate: select report0_.id_report as id_report, report0_.Id_Article as Id_Article, report0_.articleUsageType as articleU3_, report0_.comments as comments, report0_.cost as cost, report0_.date as date, report0_.Id_Error as Id_Error, report0_.Id_ProcessType as Id_Proce8_, report0_.producedQuantity as produced9_, report0_.progress as progress, report0_.quantity as quantity, report0_.Id_ReportChange as Id_Repo12_, report0_.reportType as reportType, report0_.Id_Resource as Id_Reso14_, report0_.resourceCost1 as resourc15_, report0_.resourceCost2 as resourc16_, report0_.resourceCost3 as resourc17_, report0_.resourceCost4 as resourc18_, report0_.Id_Sale as Id_Sale, report0_.Id_Service as Id_Service, report0_.signed as signed, report0_.started as started, report0_.stopDate as stopDate, report0_.stopped as stopped, report0_.time as time, report0_.timeOnly as timeOnly, report0_.Id_ArticleUsage as Id_Arti27_, report0_.Id_User as Id_User, (select OrderNumber.Number from OrderNumber where (OrderNumber.Id_Sale = report0_.Id_Sale)) as f3_, (select Product.Name from Product where (Product.Id_Sale = report0_.Id_Sale)) as f4_, (select Company.Name from Company, dbo.Sale where Company.Id = dbo.Sale.Id_Customer and (dbo.Sale.Id_Sale = report0_.Id_Sale)) as f5_ from Report report0_ where ((report0_.Id_User=? ))and((report0_.reportType=? ))and((report0_.signed=0 ))
10:18:10,101 INFO [STDOUT] Hibernate: select report0_.id_report as id_report, report0_.Id_Article as Id_Article, report0_.articleUsageType as articleU3_, report0_.comments as comments, report0_.cost as cost, report0_.date as date, report0_.Id_Error as Id_Error, report0_.Id_ProcessType as Id_Proce8_, report0_.producedQuantity as produced9_, report0_.progress as progress, report0_.quantity as quantity, report0_.Id_ReportChange as Id_Repo12_, report0_.reportType as reportType, report0_.Id_Resource as Id_Reso14_, report0_.resourceCost1 as resourc15_, report0_.resourceCost2 as resourc16_, report0_.resourceCost3 as resourc17_, report0_.resourceCost4 as resourc18_, report0_.Id_Sale as Id_Sale, report0_.Id_Service as Id_Service, report0_.signed as signed, report0_.started as started, report0_.stopDate as stopDate, report0_.stopped as stopped, report0_.time as time, report0_.timeOnly as timeOnly, report0_.Id_ArticleUsage as Id_Arti27_, report0_.Id_User as Id_User, (select OrderNumber.Number from OrderNumber where (OrderNumber.Id_Sale = report0_.Id_Sale)) as f3_, (select Product.Name from Product where (Product.Id_Sale = report0_.Id_Sale)) as f4_, (select Company.Name from Company, dbo.Sale where Company.Id = dbo.Sale.Id_Customer and (dbo.Sale.Id_Sale = report0_.Id_Sale)) as f5_ from Report report0_ where ((report0_.Id_User=? ))and((report0_.reportType=? ))and((report0_.signed=0 ))
10:18:10,181 WARN [JDBCExceptionReporter] SQL Error: 512, SQLState: 21000
10:18:10,181 ERROR [JDBCExceptionReporter] Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
10:18:10,181 WARN [JDBCExceptionReporter] SQL Error: 512, SQLState: 21000
10:18:10,181 ERROR [JDBCExceptionReporter] Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
10:18:10,181 ERROR [JDBCExceptionReporter] Could not execute query
java.sql.SQLException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
at net.sourceforge.jtds.jdbc.SqlMessage.toSQLException(SqlMessage.java:392)
at net.sourceforge.jtds.jdbc.SQLWarningChain.addOrReturn(SQLWarningChain.java:91)
at net.sourceforge.jtds.jdbc.Tds.startResultSet(Tds.java:3792)
at net.sourceforge.jtds.jdbc.TdsResultSet.startResultSet(TdsResultSet.java:123)
at net.sourceforge.jtds.jdbc.TdsResultSet.<init>(TdsResultSet.java:114)
at net.sourceforge.jtds.jdbc.TdsStatement.getMoreResults(TdsStatement.java:723)
at net.sourceforge.jtds.jdbc.TdsStatement.executeCallImpl(TdsStatement.java:302)
at net.sourceforge.jtds.jdbc.TdsStatement.internalExecuteCall(TdsStatement.java:282)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.execute(PreparedStatement_base.java:136)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:262)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:304)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1544)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at org.springframework.orm.hibernate.HibernateTemplate$20.doInHibernate(HibernateTemplate.java:365)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:170)
at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:358)
at com.admera.report.server.persistence.ReportHelper.getActiveReports(ReportHelper.java:129)
at com.admera.report.server.ReportServerBean.search(ReportServerBean.java:56)
at sun.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
10:18:10,181 INFO [SQLStateSQLExceptionTranslator] Translating SQLException with SQLState '21000' and errorCode '512' and message [Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.]; SQL was [null] for task [HibernateAccessor]
10:18:10,191 ERROR [LogInterceptor] RuntimeException:
org.springframework.jdbc.UncategorizedSQLException: (HibernateAccessor): encountered SQLException [Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.]; nested exception is java.sql.SQLException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
java.sql.SQLException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
at net.sourceforge.jtds.jdbc.SqlMessage.toSQLException(SqlMessage.java:392)
at net.sourceforge.jtds.jdbc.SQLWarningChain.addOrReturn(SQLWarningChain.java:91)
at net.sourceforge.jtds.jdbc.Tds.startResultSet(Tds.java:3792)
at net.sourceforge.jtds.jdbc.TdsResultSet.startResultSet(TdsResultSet.java:123)
at net.sourceforge.jtds.jdbc.TdsResultSet.<init>(TdsResultSet.java:114)
at net.sourceforge.jtds.jdbc.TdsStatement.getMoreResults(TdsStatement.java:723)
at net.sourceforge.jtds.jdbc.TdsStatement.executeCallImpl(TdsStatement.java:302)
at net.sourceforge.jtds.jdbc.TdsStatement.internalExecuteCall(TdsStatement.java:282)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.execute(PreparedStatement_base.java:136)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:262)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:304)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1544)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at org.springframework.orm.hibernate.HibernateTemplate$20.doInHibernate(HibernateTemplate.java:365)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:170)
at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:358)
at com.admera.report.server.persistence.ReportHelper.getActiveReports(ReportHelper.java:129)
at com.admera.report.server.ReportServerBean.search(ReportServerBean.java:56)
at sun.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
|