Aplaws 5.2 Pdl problem

"David Young" <[email protected]> Fri, 16 Jul 2004 16:12:19 +0100
Newsgroups gmane.linux.redhat.ccm.general
Message-ID <[email protected]>
Hi,

I'm using Aplaws 5.2, and I am developing the following pdl for
attaching data to a User Object.  I have used the UserAuthentication pdl
as a template for this pdl.


###################################

object type NotificationUserProfile {

   BigDecimal id = notification_user_profiles.profile_id INTEGER;

   unique String [0..1] mobilePhoneNumber =
notification_user_profiles.mobile_phone_number VARCHAR(50);

  // ... other stuff cut out

   User [1..1] user = join notification_user_profiles.user_id to
users.user_id;

   object key (id);
   join notification_user_profiles.profile_id to parties.party_id;

   // Avoid deletion of parties with the profile
   delete {
      do {
         delete from notification_user_profiles where profile_id = :id
      }
   }

   insert {
      do {
         insert into notification_user_profiles
         (profile_id, email_varified, mobile_varified,
          event_sms, event_email, news_sms, news_email,
          meetings_sms, meetings_email,
          mobile_phone_number, user_id)
         values
         (:id, :emailVarified, :mobileVarified,
          'N', 'N', 'N', 'N', 'N', 'N',
          :mobilePhoneNumber, :user.id)
      }
   }

   update {
      do {
         update notification_user_profiles
         set email_varified = :emailVarified,
             mobile_varified = :mobileVarified,
             event_sms = :eventSMS,
             event_email = :eventEmail,
             news_sms = :newsSMS,
             news_email = :newsEmail,
             meetings_sms = :meetingsSMS,
             meetings_email = :meetingsEmail,
             mobile_phone_number = :mobilePhoneNumber,
             user_id = :user.id
         where id = :id
      }
   }

   add user {}
   remove user {}

}

################################################


This seems to work fine up until you try to delete a user using the
standard admin tools.  Deleting the user violates a foreign key type
constraint on the notification_user_profiles table and therefore fails.

I'm unsure how I go about changing the behaviour so that the delete
operation on the user cascades to the profile.

I can't work out why this fails for this profile, but is successful for
the UserAuthentication.

Thanks

David


**********************************************************************
The information contained in this transmission may be
confidential and may also be the subject of legal
professional privilege. If you are not the intended recipient,
any use, disclosure or copying of any part of this transmission
is unauthorised. If you have received this transmission in
error, please notify the originator immediately.

www.southoxon.gov.uk
**********************************************************************


-- 
Redhat-ccm-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-ccm-list
Archives: https://www.redhat.com/pipermail/redhat-ccm-list/