Package Models.Pojo

Examples of Models.Pojo.Book


        return col_names[col];
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
      Book book = (Book) list.get(rowIndex);
     
       Author author = book.getAuthor();
     
        switch(columnIndex){
            case 0 : return book.getId();
            case 1 : return book.getName();
            //case 2 : return book.getAuthor_id();
            case 2 : return author.getFull_name();
            case 3 : return book.getPrice();
            case 4 : return book.getTotal_pages();
               
        }
        return new String();
    }
View Full Code Here


       
        //set author id from combobox 
        Author author = (Author)cmboxAuthor.getSelectedItem();
        int author_id = author.getId();
       
        Book book = new Book();
        book.setName(bookName);
        book.setAuthor_id(author_id);
        book.setPrice(price);
        book.setTotal_pages(total_pages);
       
        BookModel bookModel = new BookModel();
        int flag = bookModel.save(book);
       
        if(flag == 1)
View Full Code Here

       
        try {
            stmt = conn.createStatement();
            rs = stmt.executeQuery(query);
            while (rs.next()) {
                Book book = setterForBook(rs);
               
                books.add(book);
            }

        } catch (SQLException ex) {
View Full Code Here

            String book_name_query = book_name+"%";
            prepStmt.setString(1, book_name_query);
            rs = prepStmt.executeQuery();
            System.out.println("Book to search "+book_name);
            while (rs.next()) {
                Book book = setterForBook(rs);
               
                books.add(book);
            }

        } catch (SQLException ex) {
View Full Code Here

    }
   
    /*Private Functions Below : */
   
    private Book setterForBook(ResultSet rs) throws SQLException {
        Book book = new Book();
        book.setId(rs.getInt("id"));
        book.setName(rs.getString("name"));
        book.setAuthor_id(rs.getInt("author_id"));
        book.setPrice(rs.getFloat("price"));
        book.setTotal_pages(rs.getInt("total_pages"));
        //Set the author object for book.
        AuthorModel authorModel = new AuthorModel();
        Author author = authorModel.whereId(book.getAuthor_id());
        book.setAuthor(author);
        return book;
    }
View Full Code Here

TOP

Related Classes of Models.Pojo.Book

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.