Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"from unexpected" when createQuery

I get a error when I createQuery:

'from' unexpected

enter image description here

My code is below:

    @Override
    public Admin findByAdmin(Admin admin) {

        return (Admin) sessionFactory.getCurrentSession().
                createQuery("from Admin where admin_name=? and pwd=?").
                setParameter(0, admin.getAdminName()).
                setParameter(1, admin.getAdminPwd()).
                uniqueResult();

    }
like image 605
user7693832 Avatar asked Mar 18 '17 05:03

user7693832


2 Answers

I'm new to this but had the same error. What fixed things was adding the Hibernate facet under Project Structure - Facets.

like image 55
Ramona Florina Barbieru Avatar answered Oct 24 '22 04:10

Ramona Florina Barbieru


To fix this error in intelliJ idea

Right click on Your Project ---> Framework support : check mark on "Hibernate"

Press OK.

like image 29
Prashanth Terala Avatar answered Oct 24 '22 04:10

Prashanth Terala