
ssh框架总是出现could not execute query是为什么?
我用ssh框架编写一个程序,用spring自动生成的DAO里面的方法查和自己写的方法,总是会出现couldnotexecutequery这个错误?不知道是为什么?哪们高人...
我用ssh框架编写一个程序,用spring 自动生成的DAO里面的方法查和自己写的方法,总是会出现could not execute query这个错误?
不知道是为什么?哪们高人指点一下! 展开
不知道是为什么?哪们高人指点一下! 展开
5个回答
2013-03-31
展开全部
4 、 修改 User.hbm.xml 文件
将 < class name = "com.oa.data.bo.User" table = "userlist" catalog = "test" >
改为 < class name = "com.oa.data.bo.User" table = "userlist" >
如果不修改的话将会出现以下错误信息
org.springframework.jdbc.BadSqlGrammarException : Hibernate operation: could not execute query; bad SQL grammar [select user0_.id as id, user0_.userName as userName0_, user0_.userPwd as userPwd0_ from test__userlist user0_ where userName=?]; nested exception is java.sql.SQLException : Table 'test.test__userlist' doesn't exist
答案补充 更多信息可以到http://www.blogjava.net/oksonic/archive/2006/03/29/37942.aspx 里面什么都有!!
将 < class name = "com.oa.data.bo.User" table = "userlist" catalog = "test" >
改为 < class name = "com.oa.data.bo.User" table = "userlist" >
如果不修改的话将会出现以下错误信息
org.springframework.jdbc.BadSqlGrammarException : Hibernate operation: could not execute query; bad SQL grammar [select user0_.id as id, user0_.userName as userName0_, user0_.userPwd as userPwd0_ from test__userlist user0_ where userName=?]; nested exception is java.sql.SQLException : Table 'test.test__userlist' doesn't exist
答案补充 更多信息可以到http://www.blogjava.net/oksonic/archive/2006/03/29/37942.aspx 里面什么都有!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-03-31
展开全部
连接mysql时候,得去掉 映射的表.hbm.xml 中的catalog ="test"
你把你写的方法发下看看
你把你写的方法发下看看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-03-31
展开全部
sql 语句错了吧
把sql语句打印出来看看
把sql语句打印出来看看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不能执行查询,应该是你的方法有问题吧?看看sql,或者hql,如果没问题再看看查询的方法
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询