org.hibernate.exception.SQLGrammarException:could not execute query异常代码如下:public class IndexAction extends Action {..String hql = " from UserInfo where username='" + username + "'";Hibernate hn = new Hibernate();UserInfo info = (UserInf

来源:学生作业帮助网 编辑:作业帮 时间:2024/10/09 12:38:29
org.hibernate.exception.SQLGrammarException:could not execute query异常代码如下:public class IndexAction extends Action {..String hql =
xTNA~Ioh#iDJA *64Xyt ۙvfV !B4FĿ+~CJ2m-H089s7|}ƌhC\D8/tJ`jxpi Y:*v݌iVyx3o dh-RI}aJ0l F́YR0 ; po[\izg-sodD x4CPOJwL/zxuraWJȡ!Y|I)eLyz7I8F4qO y"sH0QǝQLpÂB$w!bXv3\!xs<DMQ)4 \6S%.pRSA$>֛/t{ke<^[O[筝 x4hdPaa2ҚzֳK”2}dڵvyZsʲo?_~_h5 v+ gw {VR \ߜNJ,m䭽Q\ k}h2gf3TQ9aMIQIAfd)p49e!]O &FF 9f҂/8paaj\S;ٲg<ϒ#j~[nh8sA0Eu/Uס`E #:]o<>g~'

org.hibernate.exception.SQLGrammarException:could not execute query异常代码如下:public class IndexAction extends Action {..String hql = " from UserInfo where username='" + username + "'";Hibernate hn = new Hibernate();UserInfo info = (UserInf
org.hibernate.exception.SQLGrammarException:could not execute query异常
代码如下:public class IndexAction extends Action {
.
.
String hql = " from UserInfo where username='" + username + "'";
Hibernate hn = new Hibernate();
UserInfo info = (UserInfo) hn.queryOne(hql);
.
.
}
public class Hibernate {
...
public Object queryOne(String hql) {
this.openSession();
Object obj = null;
try {
obj = (Object) session.createQuery(hql).setMaxResults(1).
uniqueResult();
} catch (Exception e) {
System.out.println("------在检索对象时抛出异常,内容如下:");
e.printStackTrace();
}
this.closeSession();
return obj;
}
...
}
执行try {
obj = (Object) session.createQuery(hql).setMaxResults(1).
uniqueResult();
} catch (Exception e) {
System.out.println("------在检索对象时抛出异常,内容如下:");
e.printStackTrace();
}
时总是捕捉到异常,然后就提示错误,
我是从mySql数据库改为orcle的 是不是连接的错误啊?
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@localhost:1521:orcl
org.hibernate.dialect.OracleDialect
LIUGUOQI
liuguoqi

org.hibernate.exception.SQLGrammarException:could not execute query异常代码如下:public class IndexAction extends Action {..String hql = " from UserInfo where username='" + username + "'";Hibernate hn = new Hibernate();UserInfo info = (UserInf
这是我的配置信息,
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
jkems
jdbc:oracle:thin:@192.168.5.245:1521:oracle
org.hibernate.dialect.Oracle9Dialect
MyOracle Conection
123456
oracle.jdbc.driver.OracleDriver