Removing an AlertNotification from a Definition?

Heiko W.Rupp hrupp at redhat.com
Thu Jan 10 16:57:07 UTC 2013


Hi,

I have this code

 public Response deleteNotification(@PathParam("nid") int notificationId) {

        AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId);
        AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId());

        definition.getAlertNotifications().remove(notification);

        alertDefinitionManager.updateAlertDefinition(caller,definition.getId(),definition,true);

        entityManager.flush();

Which always bails out with javax.persistence.OptimisticLockException: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

I have tried dozens of ways, but always end up with an error.

When removing a notification in the UI, the AlertDefinition that is passed into updateAlertDefinition() also just does not
have the notification set anymore.

Any ideas?

  Heiko

-- 
Reg. Adresse: Red Hat GmbH, Technopark II, Haus C, 
Werner-von-Siemens-Ring 14, D-85630 Grasbrunn
Handelsregister: Amtsgericht München HRB 153243
Geschaeftsführer:  Mark Hegarty, Charlie Peters, Michael Cunningham, Charles Cachera

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.fedorahosted.org/pipermail/rhq-devel/attachments/20130110/a5a080c8/attachment.sig>


More information about the rhq-devel mailing list