Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 520867 ... vs dd0098 ... for ruralHouses/src/dataAccess/DB4oManager.java

Diff revisions: vs.
  @@ -459,9 +459,12 @@
459 459 RuralHouse house = new RuralHouse(rh.getHouseName(), null, null, null,
460 460 null);
461 461 try {
462 - ObjectSet<Owner> result = db.queryByExample(house);
462 + ObjectSet<RuralHouse> result = db.queryByExample(house);
463 463 if (result.isEmpty()) {
464 - db.store(rh);
464 + Owner ow = (Owner) db.queryByExample(rh.getOwner()).get(0);
465 + db.delete(ow);
466 + ow.addRuralHouse(rh);
467 + db.store(ow);
465 468 db.commit();
466 469 stored = true;
467 470 } else {
  @@ -488,6 +491,7 @@
488 491 if (!rhs.isEmpty()) {
489 492 Owner found = result.get(0);
490 493 found.getRuralHouses().remove(rhs.get(0));
494 + db.delete(rhs.get(0));
491 495 db.store(found);
492 496 db.commit();
493 497 }