I have a problem about Hibernate 4.3.11 , I have two pojos : X and Y that Y extends X , Actually Y is a subjoin class in X.hbm . When i excute this update on Y pojo , All of the Y records have updated ,but I want to update Y where id is 123
This my HQL :
string hql = " update Y set Y.name = :name where e.id = :id "
Query query = getSession().createQuery(hql);
query.setParameter("name",name);
query.setParameter("id",123);
query.executeUpdate();
When it excutes query it generates this SQL command :
update Y set Y.name = ? where (X_Id) IN(select X_Id from HT_Y)
Moreover I don't want to use createSQLQuery(...) , Do you have any solution to help me?