Hi,
In general you place named queries after the </class> tag in your .hbm.xml files. I assume that your sequence query simply is a regular query (and queries which are placed in your hm.xml files are also called named queries).
MAPPING FILE:
Code:
[...]
</class>
<sql-query name="stakeholderChanged">
UPDATE track
LEFT JOIN share ON track.id = share.track_id
LEFT JOIN stakeholder ON stakeholder.id = share.stakeholder_id
SET track.flag = :flag
WHERE stakeholder.id = :id
</sql-query>
</hibernate-mapping>
CODE:
Code:
public void executeStakeholderChanged(Stakeholder s) {
org.hibernate.Query q = getSession().getNamedQuery("stakeholderChanged");
q.setInteger("flag", Stakeholder.FLAG_UPDATED);
q.setString("id", s.getId().toString());
q.executeUpdate();
}