java.sql.SQLException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • No title
    via by Unknown author,
  • Could not find prepared statement with handle
    via by Unknown author,
  • Could not find prepared statement with handle
    via by Unknown author,
  • Usually when you have the table name with space in its name, you need to escape it while using it in the hbm file and that works. But if you have a property with formula that uses the same table, calling this code below it throws up error : org.hibernate.exception.SQLGrammarException Query query = session.createQuery("from tablewithspace"); List list = query.list(); tablewithspace.hbm.xml ------------------------------------ <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="tablewithspace" entityname="tablewithspace" table="[table with space]"> <id name="id" column="id" length="10" type="int"/> <property name="formulacol" formula="(select count(*) from [table with space])" type="string"/> <property name="name" column="name" length="50" type="string"/> </class> </hibernate-mapping> ----------------------------------- The stackstrace is org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.loader.Loader.doList(Loader.java:2231) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) Caused by: java.sql.SQLException: [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'ctablewith0_.table with space'. at macromedia.jdbc.base.BaseExceptions.createException(Unknown Source) at macromedia.jdbc.base.BaseExceptions.getException(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) at macromedia.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source) at macromedia.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source) at macromedia.jdbc.base.BaseStatement.postImplExecute(Unknown Source) at macromedia.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source) at macromedia.jdbc.base.BaseStatement.commonExecute(Unknown Source) at macromedia.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source) at macromedia.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source) at macromedia.jdbc.base.BasePreparedStatementPoolable.executeQuery(Unknown Source) at coldfusion.server.j2ee.sql.JRunPreparedStatement.executeQuery(JRunPreparedStatement.java:74) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate.loader.Loader.getResultSet(Loader.java:1808) at org.hibernate.loader.Loader.doQuery(Loader.java:697) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) ... 40 more
    via by Rupesh Kumar,
  • Usually when you have the table name with space in its name, you need to escape it while using it in the hbm file and that works. But if you have a property with formula that uses the same table, calling this code below it throws up error : org.hibernate.exception.SQLGrammarException Query query = session.createQuery("from tablewithspace"); List list = query.list(); tablewithspace.hbm.xml ------------------------------------ <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="tablewithspace" entityname="tablewithspace" table="[table with space]"> <id name="id" column="id" length="10" type="int"/> <property name="formulacol" formula="(select count(*) from [table with space])" type="string"/> <property name="name" column="name" length="50" type="string"/> </class> </hibernate-mapping> ----------------------------------- The stackstrace is org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.loader.Loader.doList(Loader.java:2231) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) Caused by: java.sql.SQLException: [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'ctablewith0_.table with space'. at macromedia.jdbc.base.BaseExceptions.createException(Unknown Source) at macromedia.jdbc.base.BaseExceptions.getException(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) at macromedia.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source) at macromedia.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source) at macromedia.jdbc.base.BaseStatement.postImplExecute(Unknown Source) at macromedia.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source) at macromedia.jdbc.base.BaseStatement.commonExecute(Unknown Source) at macromedia.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source) at macromedia.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source) at macromedia.jdbc.base.BasePreparedStatementPoolable.executeQuery(Unknown Source) at coldfusion.server.j2ee.sql.JRunPreparedStatement.executeQuery(JRunPreparedStatement.java:74) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate.loader.Loader.getResultSet(Loader.java:1808) at org.hibernate.loader.Loader.doQuery(Loader.java:697) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) ... 40 more
    via by Rupesh Kumar,
    • java.sql.SQLException: [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'ListOrder'. at macromedia.jdbc.base.BaseExceptions.createException(Unknown Source) at macromedia.jdbc.base.BaseExceptions.getException(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) at macromedia.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) at macromedia.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source) at macromedia.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source) at macromedia.jdbc.base.BaseStatement.postImplExecute(Unknown Source) at macromedia.jdbc.base.BaseStatement.commonExecute(Unknown Source) at macromedia.jdbc.base.BaseStatement.executeInternal(Unknown Source) at macromedia.jdbc.base.BaseStatement.execute(Unknown Source) at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:348) at coldfusion.sql.Executive.executeQuery(Executive.java:1220) at coldfusion.sql.Executive.executeQuery(Executive.java:1008) at coldfusion.sql.Executive.executeQuery(Executive.java:939) at coldfusion.sql.SqlImpl.execute(SqlImpl.java:325) at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:831) at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:521)
    No Bugmate found.