debugging
authorEneko Pinzolas Murua <kelossus@localhost.localdomain>
Sun, 19 Apr 2015 21:47:53 +0000 (23:47 +0200)
committerEneko Pinzolas Murua <kelossus@localhost.localdomain>
Sun, 19 Apr 2015 21:47:53 +0000 (23:47 +0200)
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/gui/ModifyHouseGUI.java

index 03601e1..6b4dd25 100644 (file)
@@ -80,7 +80,9 @@ public class DB4oManager {
                configuration = Db4oEmbedded.newConfiguration();
                configuration.common().activationDepth(c.getActivationDepth());
                configuration.common().updateDepth(c.getUpdateDepth());
-               configuration.common().objectClass(Owner.class).cascadeOnDelete(true);
+               configuration.common().objectClass(Owner.class).cascadeOnUpdate(true);
+               configuration.common().objectClass(RuralHouse.class).cascadeOnUpdate(true);
+               configuration.common().objectClass(Account.class).cascadeOnUpdate(true);
                db = Db4oEmbedded.openFile(configuration, c.getDb4oFilename());
        }
 
@@ -463,11 +465,10 @@ public class DB4oManager {
                        if (result.isEmpty()) {
                                Owner ow = (Owner) db.queryByExample(rh.getOwner()).get(0);
                                ObjectSet<RuralHouse> orh = db.queryByExample(new RuralHouse(null, ow, null, null, null));
+                               ow.addRuralHouse(rh);
                                for (RuralHouse aa: orh){
-                                       db.delete(aa);
+                                       aa.setOwner(ow);
                                }
-                               db.delete(ow);
-                               ow.addRuralHouse(rh);
                                db.store(ow);
                                db.commit();
                                stored = true;
index 6b64b19..393a707 100644 (file)
@@ -138,6 +138,7 @@ public class ModifyHouseGUI extends JFrame {
                                        owner.getRuralHouses().remove(rh);
                                        owner.getRuralHouses().add(newRh);
                                        houseBox.removeItem(rh);
+                                       hm.removeHouse(rh, o);
                                        feedback.setText("House properly modified");
                                } else
                                        feedback.setText("Imposible to modify the house");