Created attachment 1123139 [details] Archive file that contains first_deployment.zip, second_deployment.zip, third_deployment.zip and undeployed_war.zip archives Description of problem: Undeployment of the resource leaves all previously deployed package versions in the database. In a long run, this will fill up the database. We should remove all content data from the database once relevant resource is undeployed. Version-Release number of selected component (if applicable): RHQ 4.12 How reproducible: Always Steps to Reproduce: 1. Deployed memoryleak.war file with package version 1.0 to the EAP server (RHQ UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - first_deployment.zip; 2. Deployed memoryleak.war file with package version 2.0 to the EAP server (RHQ UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - second_deployment.zip; 3. Deployed memoryleak.war file with package version 3.0 to the EAP server (RHQ UI -> Inventory -> Servers -> EAP -> Inventory -> Create Child -> Deployment) see attached screen shots - third_deployment.zip; 4. Undeployed memoryleak.war resource (RHQ UI -> Inventory -> Servers -> EAP -> Inventory -> select "memoryleak.war" resource -> press "Uninventory" button) - as a result rhq_resource table did not contain "memoryleak.war" but rhq_package_version and rhq_package_bits still contained previously deployed content - see undeployed_war.zip Actual results: Selected resource was properly deleted (rhq_resource does not contain deleted resource) but rhq_package_version and rhq_package_bits tables still contained all previously deployed content data (undeployed_war.zip) Expected results: When resource is undeployed - all its history should be deleted from the database including content data. Additional info: