"from unexpected" when createQuery

I get an error when creating Query:

'of' 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();

    }
+6
source share
2 answers

I am new to this, but had the same error. What fixed things were adding the Hibernate face to the project structure - the face.

+5
source

To fix this error in the intelliJ idea : right-click the Project icon ---> Platform Support ---> on "Hibernate" , then click ok !

+2
source

Source: https://habr.com/ru/post/1015853/


All Articles