0

Below is my code

String query="select w.statusCode,w.updateTime,s.statusCodeValue from WebsiteAvailability w,StatusCodes s where w.statusCode=s.statusCode and w.url=:sel";
String selUrl="www.google.com";
list=session.createQuery(query).setParameter("sel",selUrl).list();

The problem is in my HQL query in 'where' condition w.url=? it is taking.I checked it in server log and it is taking ? instead of selUrl value.Please help me.Here I am using hibernate so I used entities,properties instead of tables,column names. Thank you.

4

1 に答える 1

0

コードにエラーは含まれていません。それはうまくいくはずです。パラメータを渡す他の方法は次のようなものです:

String query="select w.statusCode,w.updateTime,s.statusCodeValue from WebsiteAvailability w,StatusCodes s where w.statusCode=s.statusCode and w.url= ?";
String selUrl="www.google.com";
list=session.createQuery(query).setString(0,selUrl).list();
于 2013-06-03T08:00:05.543 に答える