Bug 952652 - Unable to delete a user who has saved searches objects in the database
Summary: Unable to delete a user who has saved searches objects in the database
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ER01
: JON 3.2.0
Assignee: Thomas Segismont
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-16 11:16 UTC by Thomas Segismont
Modified: 2014-01-02 20:39 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Thomas Segismont 2013-04-16 11:16:17 UTC
Description of problem:
It's not possible to delete a user who has saved searches objects in the database.

Version-Release number of selected component (if applicable):
4.6

How reproducible:
Always

Steps to Reproduce:
1. Create a user with admin account
2. Logout and login as the new user 
3. Create a saved search
4. Logout and re-login as RHQ admin
5. Delete the new user
  
Actual results:
The user is not deleted and en error message "Failed to delete user [[xxxxx]]" is shown

Expected results:
The user is deleted

Additional info:

Reported by community on forum:
https://community.jboss.org/message/808527

Logs:

13:12:13,316 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-0.0.0.0-0.0.0.0-7080-6) SQL Error: 0, SQLState: 23503
13:12:13,317 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-0.0.0.0-0.0.0.0-7080-6) L'élément du batch 0 delete from RHQ_SUBJECT where ID=10001 a été annulé. Appeler getNextException pour en connaître la cause.
13:12:13,318 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-0.0.0.0-0.0.0.0-7080-6) SQL Error: 0, SQLState: 23503
13:12:13,319 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-0.0.0.0-0.0.0.0-7080-6) ERREUR: UPDATE ou DELETE sur la table « rhq_subject » viole la contrainte de clé étrangère
« rhq_saved_search_subject_id_fkey » de la table « rhq_saved_search »
  Détail : La clé (id)=(10001) est toujours référencée à partir de la table « rhq_saved_search ».

Comment 1 Charles Crouch 2013-04-17 16:11:37 UTC
Targetting at JON32

Comment 2 Charles Crouch 2013-04-17 16:12:34 UTC
Setting to high priority as this is annoying and I hope in theory be relatively easy to fix

Comment 3 Thomas Segismont 2013-05-02 11:00:54 UTC
Fixed in master 8e62d50

commit 8e62d50b8edd576ca3b53ecb9c198d9df288b35d
Author: Thomas Segismont <tsegismo>
Date:   Thu May 2 12:55:57 2013 +0200

    Bug 952652 - Unable to delete a user who has saved searches objects in the database
    
    Now deleting saved searches prior to deleting the user.
    Merged delete methods.
    Fail fast if caller tries to delete a superuser.
    Added itest for the BZ

Comment 4 Simeon Pinder 2013-07-02 20:33:41 UTC
This bz is available for testing with the latest 3.2.x brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=280316

Comment 5 Larry O'Leary 2013-09-06 14:33:24 UTC
As this is MODIFIED or ON_QA, setting milestone to ER1.

Comment 6 Mike Foley 2013-09-13 21:51:31 UTC
verified


Note You need to log in before you can comment on or make changes to this bug.