cjsolomon / Mulit-Modal

SRU Multi-Modal Project
0 stars 2 forks source link

loading a non-existent entry from database #6

Closed ghost closed 10 years ago

ghost commented 10 years ago

The following code snippet creates an out of bounds exception

Cargo test_cargo = new Cargo();
        test_cargo.setVehicleName("deleteTest");
        test_cargo.Update();
        test_cargo.Delete();
        Cargo test_cargo2 = Cargo.LoadAll(new String("where ShipName = 'DeleteTest'")).get(0);

I am thinking it should return a default object or something like that. It does not exit cleanly. It will need fixed for all classes, not just cargo

zgp1001 commented 10 years ago

Should no longer cause out of bounds exception, should return a default object.

ghost commented 10 years ago

I verify that this is working but it has an unanticipated side effect. The following code

test_cargo.setVehicleName("InsertLoadTest");
        test_cargo.Update();
        Cargo test_cargo2 = Cargo.LoadAll(new String("where ShipName = 'InsertLoadTest'")).get(0);

Returns that it cannot find the object in the database. The object is clearly in the database. I can verify that it is there manually. So while it no longer returns an out of bounds exception when trying to load a non-existent object it is failing to properly load an existing object.

zgp1001 commented 10 years ago

Is this resolved then as soon as its added to the other classes?

ghost commented 10 years ago

This may need more work. I'll fix my code and it may need reverted because there are other issues that expect it to return nothing.