org.hibernate.exception.SQLGrammarException: could not execute query
来源:互联网 发布:淘宝人工客服怎么找 编辑:程序博客网 时间:2024/05/16 09:21
Exception in thread "main" 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:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at com.lr8818.test.TestQuery.main(TestQuery.java:26)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'dbo.Ccms_Student'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
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:2232)
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:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at com.lr8818.test.TestQuery.main(TestQuery.java:26)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'dbo.Ccms_Student'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
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:2232)
... 7 more
在使用hibernate的原生sql数据查询时出的错
原来的语句:
Session session = HibernateSessionFactory.getSession();
SQLQuery query = session.createSQLQuery("select * from CcmsStudent"); 其中CcmsStudent是po对象名
修改后:运行正常
SQLQuery query = session.createSQLQuery("select * from CCMS.dbo.Ccms_Student");其中CCMS是数据库名称 其中Ccms_Student对应的是数据库中的表名称
- org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query处理方式
- org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query处理方式
- 【J2EE】org.hibernate.exception.SQLGrammarException: could not execute query错误
- org.hibernate.exception.SQLGrammarException: could not execute query处理方式
- org.hibernate.exception.SQLGrammarException: could not execute query
- nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
- org.hibernate.exception.SQLGrammarException: could not execute query错误解决笔记
- hibernate出现异常org.hibernate.exception.SQLGrammarException:could not execute
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- 错误:org.hibernate.exception.SQLGrammarException: could not execute
- org.hibernate.exception.SQLGrammarException: could not execute statement错误
- 移动手机消息推送机制
- Sqlite3支持的数据类型 日期函数 Sqlite3 函数
- ajax控件和类库
- Sql 语句大全
- 梯度图像
- org.hibernate.exception.SQLGrammarException: could not execute query
- 30个最常用css选择器解析
- C++各大有名库的介绍
- Pentaho技术可行性分析
- android 解决listview中checkBox错位选择
- 关于centos上apache重写的设置
- myeclipse 开发webservice hello world
- LOD技术
- Linux apache配置https