开发者

HQL table named "Class"

开发者 https://www.devze.com 2023-03-23 18:30 出处:网络
I\'m creating hql and use var queryString = \"from \" + formType.Name; queryString += \" where Id= :t\";

I'm creating hql and use

var queryString = "from " + formType.Name;
        queryString += " where Id= :t";
        var query = SessionHelper.GetSession().CreateQuery(queryString).SetParameter("t", id);

My problem is 开发者_StackOverflow社区that I have table named "Class" and model Class.. So problem is that sometime formType.Name is Class and I get queryString as from Class where Id= :t and as class is keyword that throws me QuerySyntaxException. How to tell query that Class is entity name instead keyword. Thanks!


Use backticks in your mapping

<class name="´Class´">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号