Hi Guys,
I have problem in updating multiple rows using hql.
This is my mapping:
<hibernate-mapping package="com.nyse.mks.chip.businessSystem.vo">
<class name="GroupParticipantLink" table="group_participant_link" lazy="false">
<composite-id name="groupParticipantLinkKey" class="GroupParticipantLinkKey">
<key-property name="caseId" type="string" column="case_id"/>
<key-property name="eventSeq" type="integer" column="event_seq"/>
<key-property name="groupSeq" type="integer" column="group_seq"/>
<key-property name="participantId" type="integer" column="participant_id"/>
<key-property name="parentParticipantId" type="integer" column="parent_participant_id"/>
</composite-id>
<property name="childParticipantStatus" type="string" column="child_participant_status"/>
</class>
</hibernate-mapping>
The hql update query that i am currently using is:
update GroupParticipantLink gpl set gpl.childParticipantStatus=? where gpl.groupParticipantLinkKey.caseId=?
and gpl.groupParticipantLinkKey.eventSeq=? and gpl.groupParticipantLinkKey.groupSeq=?
and gpl.groupParticipantLinkKey.parentParticipantId=?
But this query is not working. I am getting error stating that
( expecting "set", found 'gpl' ).
I tried removing the alias name, then i am not getting this error.
But my problem , i need to access the properties inside my composite
primarykey object. I dont know how to access it without using alias name.
Can some one help me on this.
Hibernate version:Hibernate3.0
Code between sessionFactory.openSession() and session.close():
session = getOutsiderSession();
int updatedEntities = session.createQuery(hqlUpdate)
.setString(0,childParticipantStatus)
.setString(1,key.getCaseId())
.setInteger(2,key.getEventSeq())
.setInteger(3,key.getGroupSeq())
.setInteger(4,efpParticipantId)
.executeUpdate();
closesession(session)
thanks in advance.
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html