I am new to Hibernate.
I want to create a public Object getById(Class class,long id) function. I tried creating query like: from :nameEntity where id= :id but I’m facing problems when setting parameter for nameEntity. Hibernate doesn’t recognize it as a parameter.
I used session.createQuery function. Could you please help me?
You will either have to do String concatenation to achieve this:
or use the Criteria API: