Integrate JavaFX, Hibernate and PostgreSQL With The MVC Pattern
Integrate JavaFX, Hibernate and PostgreSQL With The MVC Pattern
ARTICLE ARCHIVE |
FORUMS |
TIP BANK
Specialized Dev Zones eBook Library .NET Java C++ Web Dev A rchitecture Database Security Open Source Enterprise Mobile Special Reports 10-Minute Solutions DevXtra Blogs
Not having data governance can hurt your business. Download this eBook to learn how to take control now.
JavaFX provides a rich set of UI controls, which simplify the development of visually immersive front ends for database-driven applications. When combined with the PostgreSQL database and the Hibernate ORM tool, JavaFX can handle the presentation layer for large-scale, datadriven business applications (JavaFX PostgreSQL) as well as robust desktop applications (JavaFX Hibernate). In this article, I demonstrate how to integrate JavaFX, Hibernate and PostgreSQL using the MVC pattern and present a sample CRUD application with a data-navigation feature.
What You Need
To follow the demo in this article, simply: 1. 2. 3. 4. 5. Install the Java SDK+JavaFX2 SDK Unpack the Eclipse IDE Install the PostgreSQL DB Unpack Hibernate Save the PostgreSQL JDBC driver
Figure 1. Project Library: Make a library for the Hibernate JavaFX PostgreSQL driver.
In this case, testdb is the table space. If you opt for creating your table through SQL or through pgAdmin III, either give the name of tablespace as testdb or change the appropriate portion of code in the HiberateUtil.java file.
c f g . s e t P r o p e r t y ( " h i b e r n a t e . h b m 2 d d l . a u t o " ," u p d a t e " ) ;
Also keep in mind the u p d a t evalue. You may also put c r e a t ein place of u p d a t e . This would recreate the table every time the application runs, deleting all stored information. So use c r e a t eor u p d a t eappropriately.
c f g . s e t P r o p e r t y ( " h i b e r n a t e . s h o w _ s q l " ," t r u e " ) ;
Alternatively, you may set the above property as f a l s e . The table created in PostgreSQL is as follows:
C R E A T ET A B L Ec o n t a c t s ( c o n t a c t i di n t e g e rN O TN U L L ,
www.devx.com/Java/Article/48193
1/3
3/28/14
Next Page
1 2
Next Page
2 Comments (click to add your com m ent) By umair October 18 2013 00:52 AM PDT Dear Manoj, Thankyou very much for this easy to understand and effective tutorial. With an ORM architecture like you explained (seems session per click) if we develop a Java FX application with say 200+ clients, would it work or should we go for EJB approach. Thanks again for this self explanatory example. Umair
Reply to this comment
By Sumudu June 29 2013 11:55 AM PDT This is very very important one thank you very very much
Reply to this comment
Ketik teks
www.devx.com/Java/Article/48193
2/3
3/28/14
Sitemap
Property of Quinstreet Enterprise. Terms of Service | Licensing & Reprints | About Us | Privacy Policy | Advertise Copyright 2014 QuinStreet Inc. All Rights Reserved.
www.devx.com/Java/Article/48193
3/3