Quote:
All the variables within the text are String variables.
Obviously some of the values are empty strings and the final query is not a valid query. In fact, you are building the query incorrectly and it will never generate a valid HQL since literal strings must be quoted. A better solution which avoids problems if the strings values contains quotes is to use parameter placeholders and use Query.setString() to set the actual values:
Code:
Query query = session.createQuery("from employment e where e.jobtitle = :job or e.jobtitle = :job1 ........");
query.setString("job", job);
query.setString("job1", job1);
// etc.
It would be even easier if you had all parameters in a list or array. Something like this:
Code:
Object[] jobs = new Object[] { job, job1, job2, etc.... };
Query query = session.createQuery("from employment e where e.jobtitle in (:jobs)");
query.setParameterList("jobs", jobs, Hibernate.STRING);