Merged the two branches, DB separated
authorcamjan <jcampos004@ikasle.ehu.es>
Thu, 21 May 2015 17:19:07 +0000 (19:19 +0200)
committercamjan <jcampos004@ikasle.ehu.es>
Thu, 21 May 2015 17:19:07 +0000 (19:19 +0200)
ruralHouses/src/businessLogic/OfferManager.java
ruralHouses/src/dataAccess/DB4oManager.java
ruralHousesDB/src/dataAccess/DB4oManager.java

index 12279a3..b46b903 100644 (file)
@@ -20,7 +20,7 @@ public final class OfferManager extends UnicastRemoteObject implements OfferInte
         */
        private static final long serialVersionUID = 1L;
 
         */
        private static final long serialVersionUID = 1L;
 
-       private int offerNumber = 0;
+       private int offerNumber = 1;
        dataAccess.DB4oManager dbMngr;
 
        public OfferManager() throws RemoteException {
        dataAccess.DB4oManager dbMngr;
 
        public OfferManager() throws RemoteException {
index a424473..e4a0f03 100644 (file)
@@ -35,9 +35,9 @@ public class DB4oManager {
        private static ObjectContainer db;
        private static EmbeddedConfiguration configuration;
        private static ClientConfiguration configurationCS;
        private static ObjectContainer db;
        private static EmbeddedConfiguration configuration;
        private static ClientConfiguration configurationCS;
-       private int bookingNumber = 0; // if it is "static" then it is not
+       private int bookingNumber = 1; // if it is "static" then it is not
                                                                        // serialized
                                                                        // serialized
-       private int offerNumber = 0; // if it is "static" then it is not serialized
+       private int offerNumber = 1; // if it is "static" then it is not serialized
        private static DB4oManager theDB4oManager = null;
 
        private static DB4oManagerAux theDB4oManagerAux;
        private static DB4oManager theDB4oManager = null;
 
        private static DB4oManagerAux theDB4oManagerAux;
@@ -45,7 +45,7 @@ public class DB4oManager {
        static ConfigXML c;
 
        private DB4oManager() throws Exception {
        static ConfigXML c;
 
        private DB4oManager() throws Exception {
-               theDB4oManagerAux = new DB4oManagerAux(0, 0);
+               theDB4oManagerAux = new DB4oManagerAux(1, 1);
                c = ConfigXML.getInstance();
                System.out.println("Creating DB4oManager instance => isDatabaseLocal: "
                                + c.isDatabaseLocal() + " getDatabBaseOpenMode: "
                c = ConfigXML.getInstance();
                System.out.println("Creating DB4oManager instance => isDatabaseLocal: "
                                + c.isDatabaseLocal() + " getDatabBaseOpenMode: "
@@ -620,8 +620,10 @@ public class DB4oManager {
                                        .getOffer().getOfferNumber(), new RuralHouse(b.getOffer()
                                        .getRuralHouse().getHouseName(), null, null, null, null),
                                        null, null, 0), b.getClient(), b.getBookDate());
                                        .getOffer().getOfferNumber(), new RuralHouse(b.getOffer()
                                        .getRuralHouse().getHouseName(), null, null, null, null),
                                        null, null, 0), b.getClient(), b.getBookDate());
-                       book.setOffer(null);
-                       db.delete(book);
+                       Booking delete = (Booking) db.queryByExample(book).get(0);
+                       delete.setOffer(null);
+                       db.store(delete);
+                       db.delete(delete);
                        db.commit();
                } catch (Exception e) {
                        e.printStackTrace();
                        db.commit();
                } catch (Exception e) {
                        e.printStackTrace();
index ea6bc69..ce7e6ca 100644 (file)
@@ -5,6 +5,9 @@ public class DB4oManager {
        
 
        private static DB4oManagerAux theDB4oManagerAux;
        
 
        private static DB4oManagerAux theDB4oManagerAux;
+       private int bookingNumber = 1; // if it is "static" then it is not
+       // serialized
+       private int offerNumber = 1; // if it is "static" then it is not serialized
        
        class DB4oManagerAux {
                int bookingNumber;
        
        class DB4oManagerAux {
                int bookingNumber;