Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 556478 ... vs e90cb4 ... for ruralHouses/src/dataAccess/DB4oManager.java

Diff revisions: vs.
  @@ -85,8 +85,9 @@
85 85 configuration.common().objectClass(Booking.class).cascadeOnDelete(true);
86 86 configuration.common().objectClass(RuralHouse.class)
87 87 .cascadeOnDelete(true);
88 - configuration.common().objectClass(Offer.class)
88 + configuration.common().objectClass(Account.class)
89 89 .cascadeOnDelete(true);
90 + configuration.common().objectClass(Offer.class).cascadeOnDelete(true);
90 91 configuration.common().objectClass(Account.class).cascadeOnUpdate(true);
91 92 db = Db4oEmbedded.openFile(configuration, c.getDb4oFilename());
92 93 }
  @@ -539,20 +540,16 @@
539 540 return false;
540 541 }
541 542
542 - // TODO remove account
543 -
544 - public boolean removeAccount(Account acc) {
543 + public boolean removeAccount(Owner own) {
545 544 if (c.isDatabaseLocal() == false)
546 545 openSDB();
547 546 else
548 547 openDB();
549 548
550 549 try {
551 - ObjectSet<Account> result = db.queryByExample(new Account(acc
552 - .getUsername()));
550 + ObjectSet<Account> result = db.queryByExample(new Account(own));
553 551 if (!result.isEmpty()) {
554 552 db.delete(result.get(0));
555 - ;
556 553 db.commit();
557 554 return true;
558 555 }
  @@ -598,10 +595,10 @@
598 595 ObjectSet<Booking> result = db.queryByExample(b);
599 596 result.get(0).getOffer().getBookings().remove(b);
600 597 db.store(result.get(0).getOffer());
598 + db.delete(result.get(0));
601 599 db.commit();
602 600 } catch (Exception e) {
603 601 e.printStackTrace();
604 - ;
605 602 } finally {
606 603 db.close();
607 604 }