HQL table named "Class"

164 views Asked by At

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 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!

1

There are 1 answers

0
mathieu On

Use backticks in your mapping

<class name="´Class´">