JavaFX MVC + JDBC + DAO + DI: Library Loan System

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ธ.ค. 2024

ความคิดเห็น • 28

  • @pkrockin3923
    @pkrockin3923 4 ปีที่แล้ว +1

    Could you do a tutorial on best practices on calling model/db on a background thread via Javafx Task and ExecutorService? That would be valuable for a beginner like me.

  • @shyamkumarrana5856
    @shyamkumarrana5856 7 ปีที่แล้ว

    can you help me sir , how to upload image and retrieve from mysql database using mvc thanks in advance

  • @DanHowardMtl
    @DanHowardMtl 7 ปีที่แล้ว +1

    In findBook method you could return - Collections.emptyList();

    • @AlmasB0
      @AlmasB0  7 ปีที่แล้ว

      Yes, thanks for that. That's a much better alternative, I must've missed it.

  • @shomookhkhaleefa9720
    @shomookhkhaleefa9720 8 ปีที่แล้ว

    Hi
    How i can open it in NetBean software ? how i can contact you for more details ?

  • @temirkhanamanbaev42
    @temirkhanamanbaev42 4 ปีที่แล้ว +1

    Thanks, man, useful

  • @mikeCavalle
    @mikeCavalle 2 ปีที่แล้ว

    Excellent

  • @abhishekdanej
    @abhishekdanej 6 ปีที่แล้ว +1

    That was amazing! Thanks.

  • @shruikan123456789
    @shruikan123456789 7 ปีที่แล้ว

    Could you do a video on the MVP pattern in JavaFX? Maybe demonstrating a Graph structure? Like Adding/removing nodes/edges and so on?

    • @AlmasB0
      @AlmasB0  7 ปีที่แล้ว

      Hi, JavaFX was designed with MVC in mind, hence the binding between view and the model. Decoupling them completely, as MVP typically requires, is likely to result in writing more boilerplate code. So I'm not sure if there's any value in implementing MVP over MVC, unless you're just curious what it's like, in which case I'd suggest googling it as there are existing examples. As for the graph demo, this can easily be done with MVC. The Model is the entire graph. We can expose two bindings: nodes and edges. Whenever either of them change, your View can listen for the events and redraw itself. Of course, a more interesting challenge is how to lay out the graph. There are numerous techniques for graph drawing. You can use Gephi - github.com/gephi/gephi to help you lay out the graph, which you can then visualize in JavaFX.

  • @stevenmc6318
    @stevenmc6318 8 ปีที่แล้ว

    you scared me about beginner but i have little knowledge about java, javafx and jdbc will i full understanding?

  • @dominiquedevries9972
    @dominiquedevries9972 3 ปีที่แล้ว

    you are the best

  • @zhengyuwang2709
    @zhengyuwang2709 9 ปีที่แล้ว

    Hi Almas,
    What if we have 3 tables, Books, Authors & Copyrights and Books-Authors are in m-n relationship? I mean a book can have several authors and an author's name can be related to several books, too.
    Could you please give some tips how we can change the ListView to TableView in GUI part?
    Thanks a lot!

    • @AlmasB0
      @AlmasB0  9 ปีที่แล้ว

      +Zhengyu Wang Hi, yes you are right. This is one of the reasons why I noted in the video description that this data organization isn't efficient. In RDB (relational databases) you would typically have AUTHORS table with unique author ID and their info such as first/last names, number of books published, country of origin, etc. BOOKS table with unique book ID and some info unique to books, like title, number of pages, original published year/language, etc. Then you could have a table that links unique book id to a unique author id. Please refer to the following links for more information:
      stackoverflow.com/questions/19170855/relational-database-for-multiple-authors-multiple-books
      stackoverflow.com/questions/13353231/how-write-down-to-database-multiple-authors-in-simple-books-table
      en.wikipedia.org/wiki/Unique_key
      As for TableView you can have a look at: github.com/AlmasB/FXCatalog/tree/master/src/main/java/com/almasb/fxcatalog
      It was never meant to be a tutorial, so code may be dodgy at times but should give you a basic idea on how to proceed with TableView

    • @zhengyuwang2709
      @zhengyuwang2709 9 ปีที่แล้ว +1

      +Almas Baimagambetov (AlmasB) Many thanks, Almas! I am going to read the links! I did learn a lot from this video but did not anticipate that you could answer me today. Happy new year!

    • @zhengyuwang2709
      @zhengyuwang2709 9 ปีที่แล้ว

      +Almas Baimagambetov (AlmasB)
      Hello again,
      Could you please offer some information about how to fix a pop-up window with input functions by clicking a button like "Add"? Using JavaFX FXML of course. Thanks!!

    • @AlmasB0
      @AlmasB0  9 ปีที่แล้ว

      Hi, what do you mean by "fix a pop-up window"? Can you also provide the use case, as I don't quite understand what you are trying to do.

    • @jdkben1606
      @jdkben1606 8 ปีที่แล้ว +1

      Thanks for this video. I'm new to Java and JavaFX but with this video, I know my bearings. Thanks a million.

  • @khiangte85
    @khiangte85 9 ปีที่แล้ว

    Hi.. can you make tutorial about how to handle database access( one database ) for distributed application in LAN

    • @AlmasB0
      @AlmasB0  9 ปีที่แล้ว

      +Lalmuanawma khiangte Hi, do you mean DBMS --- Server --- Client?

    • @khiangte85
      @khiangte85 9 ปีที่แล้ว

      +Almas Baimagambetov (AlmasB)
      I am working on java desktop application (javafx) which needs to be install/run in three different computers on same Local Network ( LAN ). But this application need to share one database and each application should be able to insert, update, delete records in the same database.
      How do i achieved that in java, any suggestion/help would be appreciated ?
      And you mentioned that "this way of organizing data is very inefficient in RDB and shouldn't be used in production".. what is the best way to deal with database.?

    • @AlmasB0
      @AlmasB0  9 ปีที่แล้ว

      You can either run a database on one of the three machines, which essentially becomes the server, or use the 4th machine to just run the database. Next step is to identify the internal IP address of that machine and use it when connecting from your client (the other 3) machines.
      In the video I stored a lot of redundant information, like name/author/date multiple times. I used the RDB like a Java List pretty much to try and simplify the tutorial. Ideally you will need to have a table which maps unique IDs with data IDs and then another table which maps data IDs with data (name/author/date). It is commonly known as data normalization. Luckily there is a lot of info about that on the Internet.

    • @khiangte85
      @khiangte85 9 ปีที่แล้ว +1

      +Almas Baimagambetov (AlmasB) Thanks !! I'm hoping to see more great JavaFX tutorial.. cheers :D

  • @nicolasparada
    @nicolasparada 9 ปีที่แล้ว +1

    Thanks, very usefull.

  • @vybhavjain6285
    @vybhavjain6285 9 ปีที่แล้ว

    Hi, I am trying to develop a console project using your technique.
    I am trying to return a list of products from the database but it is running empty list. Can you plz help me with this code.
    In DerbyProductDAO.java
    public List findAllProducts() {
    try {
    return dbAccess.query(connection, "SELECT * FROM Products", new BeanListHandler(Product.class));
    //returns an empty list from this block only
    } catch (Exception e) {
    e.printStackTrace();
    }
    return EMPTY; //does not return this empty
    }
    In ProductOperation.java
    public void getallProduct() {
    List products = productDAO.findAllProducts();
    if(products.size() > 0) {
    System.out.println("
    Size of products is "+products.size()+"
    ");
    //this returns the size correctly, which is 24
    System.out.println("Showing you products which are in the database");
    for(int i = 0; i< products.size(); i++) {
    System.out.println("Id: "+products.get(i).getProductId()+"\t" //returns 0
    +" Name: "+products.get(i).getProductName()+"\t" //returns null
    +" Price: "+products.get(i).getProductPrice()+"\t" //returns 0
    +" Company: "+products.get(i).getProductCompany()+"\t" //returns null
    +" ExpiryDate: "+products.get(i).getExpiryDate()); //returns 0
    }
    }
    }

    • @AlmasB0
      @AlmasB0  9 ปีที่แล้ว

      +Zomes Rand Hi, the code looks OK. It seems that the database is storing those objects but with their default fields, e.g. 0, null. First thing to check would be your code that sets up/writes to the database. Unfortunately at the moment I don't have any spare time to continue the tutorials or help debugging code. So my recommendation would be to copy all the tutorial code - github.com/AlmasB/LibraryLoan and then adapt/replace parts that you need. Sorry for not being of more help. Kind regards

  • @Mike606S
    @Mike606S 9 ปีที่แล้ว

    very usefull

  • @franciscoanderson9027
    @franciscoanderson9027 7 ปีที่แล้ว

    just what was that? and i thought that i was a advanced java programmer.I have to accept that i barely get lost in the code.