deleted entity passed to persist:

Adam Young ayoung at redhat.com
Wed Mar 24 15:12:54 UTC 2010


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 Young<ayoung at 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 at lists.fedorahosted.org
>> https://fedorahosted.org/mailman/listinfo/candlepin
>>
>>      
>
>
>    




More information about the candlepin mailing list