开发者

HQL table named "Class"

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜