public BookStatus getBookStatus(long bookid)
    {
    	
    	  BookStatus bookstatus = null;
          Connection con = null;
          Statement stmt = null;
          try {
              DBconnection dbCon = new DBconnection();
              Class.forName(dbCon.getJDBC_DRIVER());

              con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
                      dbCon.getDB_USERNAME(), dbCon.getDB_PASSWORD());
              stmt = con.createStatement();

              String query="Select bs.bks_id, bs.bks_reservedcopies, bs.bks_section, bs.bks_shelf, bs.branch_id "
                      +"from book b Inner join bookstatus bs on b.bookstatus_id=bs.bks_id "
                      +"where b.bok_id="+bookid;
              
              ResultSet rs = stmt.executeQuery(query);
              
              
              if (rs.next()) {
            	  bookstatus = new BookStatus();
                  bookstatus.setId(rs.getLong(1));
                  bookstatus.setReservedCopies(rs.getInt(2));
                  bookstatus.setSection(rs.getInt(3));
                  bookstatus.setShelf(rs.getInt(4));
                  bookstatus.setBranch(rs.getInt(5));
                  
                  BookBean bb=new BookBean();
                  Book mybook=bb.getBook(bookid);
                  
                  WarehouseBean wb=new WarehouseBean();
                  Warehouse mywh=wb.getWarehouse(mybook.getItem_id(), bookstatus.getBranch());
                                
                  bookstatus.setTotalCopies(mywh.getQuantity());
              }
          } catch (SQLException | ClassNotFoundException ex) {
              System.err.println("Caught Exception: " + ex.getMessage());
          } finally {
              try {
                  if (stmt != null) {
                      stmt.close();
                  }
                  if (con != null) {
                      con.close();
                  }
              } catch (SQLException ex) {
                  System.err.println("Caught Exception: " + ex.getMessage());
              }
          }
          return bookstatus;
    	
    }