If you see the above error, it seems to mean that a delete is violating a constraint.
I got this exception with the following code:
@DELETE @Path("/{dbid}") public void unbind(@PathParam("dbid") Long dbid) {
Entitlement toDelete = entitlementCurator.find(dbid); if (toDelete != null) { //toDelete.getConsumer().getEntitlements().remove(toDelete); entitlementCurator.delete(toDelete); return; } throw new NotFoundException( "Entitlement with ID '" + dbid + "' could not be found"); }
To get rid of the error, uncomment out the line //toDelete...
On Mon, Mar 22, 2010 at 8:17 PM, Adam Young ayoung@redhat.com wrote:
If you see the above error, it seems to mean that a delete is violating a constraint.
I got this exception with the following code:
@DELETE @Path("/{dbid}") public void unbind(@PathParam("dbid") Long dbid) {
Entitlement toDelete = entitlementCurator.find(dbid); if (toDelete != null) { //toDelete.getConsumer().getEntitlements().remove(toDelete); entitlementCurator.delete(toDelete); return; } throw new NotFoundException( "Entitlement with ID '" + dbid + "' could not be found"); }
To get rid of the error, uncomment out the line //toDelete...
But won't that load ALL of the consumers entitlements just to delete it?
Sincerely, jesus
Looks like it's loading all the consumer's entitlements just to delete one. Still not great but better than all consumers at least.
On Tue, Mar 23, 2010 at 12:50 AM, Jesus M. Rodriguez jmrodri@gmail.com wrote:
On Mon, Mar 22, 2010 at 8:17 PM, Adam Young ayoung@redhat.com wrote:
If you see the above error, it seems to mean that a delete is violating a constraint.
I got this exception with the following code:
@DELETE @Path("/{dbid}") public void unbind(@PathParam("dbid") Long dbid) {
Entitlement toDelete = entitlementCurator.find(dbid); if (toDelete != null) { //toDelete.getConsumer().getEntitlements().remove(toDelete); entitlementCurator.delete(toDelete); return; } throw new NotFoundException( "Entitlement with ID '" + dbid + "' could not be found"); }
To get rid of the error, uncomment out the line //toDelete...
But won't that load ALL of the consumers entitlements just to delete it?
Sincerely, jesus _______________________________________________ candlepin mailing list candlepin@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/candlepin
How many entitlements do you really think a given conumer will have? "All" is likely to be less tahn five. I think this is acceptable.
On 03/23/2010 07:55 AM, Devan Goodwin wrote:
Looks like it's loading all the consumer's entitlements just to delete one. Still not great but better than all consumers at least.
On Tue, Mar 23, 2010 at 12:50 AM, Jesus M. Rodriguezjmrodri@gmail.com wrote:
On Mon, Mar 22, 2010 at 8:17 PM, Adam Youngayoung@redhat.com wrote:
If you see the above error, it seems to mean that a delete is violating a constraint.
I got this exception with the following code:
@DELETE @Path("/{dbid}") public void unbind(@PathParam("dbid") Long dbid) { Entitlement toDelete = entitlementCurator.find(dbid); if (toDelete != null) { //toDelete.getConsumer().getEntitlements().remove(toDelete); entitlementCurator.delete(toDelete); return; } throw new NotFoundException( "Entitlement with ID '" + dbid + "' could not be found"); }
To get rid of the error, uncomment out the line //toDelete...
But won't that load ALL of the consumers entitlements just to delete it?
Sincerely, jesus _______________________________________________ candlepin mailing list candlepin@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/candlepin
On Tue, Mar 23, 2010 at 9:40 AM, Adam Young ayoung@redhat.com wrote:
How many entitlements do you really think a given conumer will have? "All" is likely to be less tahn five. I think this is acceptable.
Sure it is probably acceptable, just annoying to see code load a bunch of data only to delete one when a simple DELETE would do it without any loading whatsoever.
jesus
On 03/23/2010 07:55 AM, Devan Goodwin wrote:
Looks like it's loading all the consumer's entitlements just to delete one. Still not great but better than all consumers at least.
That's what I meant :)
[snip]
But won't that load ALL of the consumers entitlements just to delete it?
Sincerely, jesus
Just realized, this code is in the EntitlementResource, but it should really be moved to EntitlementCurator, that's where I believe we try to do most "data integrity" things like this. I also think it's in line with your comment that we're doing too much in resources recently (I can't find where this was now though).
I just hit another scenario where I need to do something similar when deleting an entitlement.
Cheers,
Devan
On Mon, Mar 22, 2010 at 9:17 PM, Adam Young ayoung@redhat.com wrote:
If you see the above error, it seems to mean that a delete is violating a constraint.
I got this exception with the following code:
@DELETE @Path("/{dbid}") public void unbind(@PathParam("dbid") Long dbid) {
Entitlement toDelete = entitlementCurator.find(dbid); if (toDelete != null) { //toDelete.getConsumer().getEntitlements().remove(toDelete); entitlementCurator.delete(toDelete); return; } throw new NotFoundException( "Entitlement with ID '" + dbid + "' could not be found"); }
To get rid of the error, uncomment out the line //toDelete...
candlepin mailing list candlepin@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/candlepin
Makes sense, and I will incorperate that into my other changes.
On 03/24/2010 10:43 AM, Devan Goodwin wrote:
Just realized, this code is in the EntitlementResource, but it should really be moved to EntitlementCurator, that's where I believe we try to do most "data integrity" things like this. I also think it's in line with your comment that we're doing too much in resources recently (I can't find where this was now though).
I just hit another scenario where I need to do something similar when deleting an entitlement.
Cheers,
Devan
On Mon, Mar 22, 2010 at 9:17 PM, Adam Youngayoung@redhat.com wrote:
If you see the above error, it seems to mean that a delete is violating a constraint.
I got this exception with the following code:
@DELETE @Path("/{dbid}") public void unbind(@PathParam("dbid") Long dbid) { Entitlement toDelete = entitlementCurator.find(dbid); if (toDelete != null) { //toDelete.getConsumer().getEntitlements().remove(toDelete); entitlementCurator.delete(toDelete); return; } throw new NotFoundException( "Entitlement with ID '" + dbid + "' could not be found"); }
To get rid of the error, uncomment out the line //toDelete...
candlepin mailing list candlepin@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/candlepin
candlepin@lists.fedorahosted.org