find below my HQL query
Query query = session.createQuery(\"select u from UserLog u where u.userLogSerialno = \" + \"(select max(uu.userLogSerialno) from Us
I is very simple to add parameter to an HQL
Query query = session.createQuery("select u from UserLog u where u.userLogSerialno = " + "(select max(uu.userLogSerialno) from UserLog uu where uu.userId = :userId)").setParameter("userId", 15);
here i have hard coded 15 you can simply use variable instead of it