I have been using a datamodel with
reservation<-> voucher for some time.

Most of the time a reservation has to be created, sometimes a voucher.
Most of the vouchers are already in the database.

The way I save the data is to create a reservation, select a voucher, and then add the voucher to the reservation, in such a way:

                defaultEC().insertObject(mySess().selectedReservation() );
mySess ().selectedReservation().setVoucherRelationship( mySess().voucher() );

After that, I add the reservation to the voucher:

mySess ().selectedReservation().setVoucherRelationship( mySess().voucher() );

and save the data:

                try {
                        defaultEC().saveChanges();
defaultEC ().refreshObject(mySess().selectedReservation().trainingdata());
                } catch (Exception e) {
                        defaultEC().revert();

                etc...

That has been working fine for ages. Now I added an extra relationship to the voucher in the BusinessLogic, (the voucher are now linked to a specific training), reran EOGenerate, but now I am getting errors that the voucher can not be saved:

May 31 08:44:22 cursusaanmelding[60001] (_Reservation.java:316) DEBUG nl.netsense.nidf.BL._Reservation - updating voucher from null to {values = {testPassedDate = <com.webobjects.foundation.NSKeyValueCoding $Null>; reservation = "null"; training = "null"; certificatePrinted = <com.webobjects.foundation.NSKeyValueCoding$Null>; bankbookdetail = "null"; vouchernumber = "60032ZPKr"; voucherCreated = <com.webobjects.foundation.NSKeyValueCoding$Null>; userTested = <com.webobjects.foundation.NSKeyValueCoding$Null>; confirmationSent = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<nl.netsense.nidf.BL.Voucher 27d525 _EOIntegralKeyGlobalID[Voucher (java.lang.Integer)60032]>"; } May 31 08:44:22 cursusaanmelding[60001] (_Voucher.java:128) DEBUG nl.netsense.nidf.BL._Voucher - updating reservation from null to {values = {emailadres = "[EMAIL PROTECTED]"; voorvoegsel = <com.webobjects.foundation.NSKeyValueCoding$Null>; telefoonprive = "02020"; dealerPc1 = "1011"; dealerPc2 = "SG"; reservationRemarks = <com.webobjects.foundation.NSKeyValueCoding$Null>; trainingdata = "<nl.netsense.nidf.BL.Trainingdata d92304 _EOIntegralKeyGlobalID[Trainingdata (java.lang.Integer)247]>"; reservationNoOfReservationsPickedUp = <com.webobjects.foundation.NSKeyValueCoding$Null>; reservationOneExtra = 1; reservationDateReservation = 2008-05-31 06:44:20 Etc/GMT; dealerHnr = "123"; dealer = "null"; adres = <com.webobjects.foundation.NSKeyValueCoding$Null>; adressen = "<nl.netsense.nidf.BL.Address cf630a <EOTemporaryGlobalID: 0 0 -63 78 79 45 0 0 -22 97 1 0 0 0 1 26 61 -72 64 -49 67 -25 83 -120>>"; reservationSerialno = "12134"; telefoonwerk = "0202020"; reservationNoOfReservations = 1; voucher = "<nl.netsense.nidf.BL.Voucher 27d525 _EOIntegralKeyGlobalID[Voucher (java.lang.Integer)60032]>"; bankbookdetail = "null"; emailok = true; achternaam = "henselmans"; voornaam = "johan"; }; this = "<nl.netsense.nidf.BL.Reservation 6f411f <EOTemporaryGlobalID: 0 0 -63 78 79 45 0 0 -22 97 2 0 0 0 1 26 61 -72 64 -49 67 -25 83 -120>>"; } May 31 08:44:22 cursusaanmelding[60001] (ERXNSLogLog4jBridge.java:41) WARN NSLog - An exception occurred while trying to save the information: <er.extensions.ERXValidationException object: {values = {testPassedDate = <com.webobjects.foundation.NSKeyValueCoding$Null>; reservation = "null"; training = "null"; certificatePrinted = <com.webobjects.foundation.NSKeyValueCoding$Null>; bankbookdetail = "null"; vouchernumber = "60032ZPKr"; voucherCreated = <com.webobjects.foundation.NSKeyValueCoding$Null>; userTested = <com.webobjects.foundation.NSKeyValueCoding$Null>; confirmationSent = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<nl.netsense.nidf.BL.Voucher 27d525 _EOIntegralKeyGlobalID[Voucher (java.lang.Integer)60032]>"; }; propertyKey: training; type: MandatoryToOneRelationshipException; additionalExceptions: ()>


I noticed that reservation (the relationship to the reservation that has just been inserted) is "null" in the ERXValidationException, but I am not sure if that is a problem.

If I remove the line

mySess ().selectedReservation().setVoucherRelationship( mySess().voucher() );

Everything is fine, apart of coure that there is no relation from the voucher to the reservation, just from the reservation to the voucher.

Have I done something wrong for ages, that now had suddenly reared its head? (Using the latest Wonder as of last night, despite the warning not to do cvs commit. I thought cvs update would be OK).

Regards,

Johan Henselmans
http://www.netsense.nl
Tel: +31-20-6267538
Fax: +31-20-6279159



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to