Latest News

Thursday 12 November 2009

Develop High Transaction Web Applications with Java MySQL & NetBeans

This entry is a brief tutorial on how to develop high transactional web application. I will be looking at how to develop a high transactional application while maintaining data integrityFor the purpose of keeping this entry simple, I will be using some RAD tools, the NetBeans IDE, to generate most of the code.

In order to follow the tutorial, you will need the following:
  1. NetBeans IDE 6.7+
  2. Java JDK 1.6+ (my version is 1.6.0_17)
  3. MySQL 5.1+
  4. MySQL Sakila database
  5. Apache Tomcat 6.x
  6. An understanding of JPA transactions and ReSTful web services
This is my definition of High Transaction Applications:

A high transaction application is one that can serve multiple simultaneous requests from clients and keep them secure from each other. The application has only two purposes: read or write data to/from a repository either JMS or DB. The transactions have to meet the ACID criteria in order to be deployed in the real world.

Ok, the above is my definition and you are free to redefine it. I am going to build a web application that will be an n-tier application:
  • Database back-end (MySQL)
  • Entity classes
  • ReSTful Web Services to allow other developers to integrate the application with theirs
  • A web based front-end
For the simplicity of the article, I will not implement any security such as user or application level security (authentication and database table privileges). This tutorial is mostly geared toward the newbies but I am sure that more advanced developers would benefit too.

Let's get coding.

  1. Make sure that you have loaded the MySQL Sakila database into your MySQL database. You can download the Sakila database from the NetBeans plugin centre (see here).
  2. Create a new web application and name whatever you like. I have named mine "WebApplication". I will now refer the application as WebApplication. Make sure to choose Tomcat as your deployment server
  3. Add the MySQL driver "mysql-connector-java-5.0.7-bin" to the WebApplication libraries. NetBeans will work and connect to the DB even without the driver but once you deploy your application to a server, the application will not be able to connect to the DB and throw a ClassNotFoundException com.mysql.jdbc.driver.

  4. We are going to develop the back-end first. NetBeans makes it very easy for us to create Entity classes from database. I would recommend newbies to learn how to manually create Entity classes and configure the persistence.xml file. This tutorial makes use of JPA but one should ignore the drawbacks of JPA/ ORM frameworks.



  5. Right click on the project name and choose Entity Classes from Database... On the next screen choose the "filmActor" table and click on the Add button. Make sure that "Include Related Tables" box is checked underneath the Selected Tables panel. The screenshot does not show the "filmActor" table as I have previously generated the Entity class but I am sure you get the idea.





  6. If you are required to create a Persistence Unit, click on the persistence button -> you can accept the default name -> choose your Persistence Library -> choose your database connection -> choose "None" for Table Generation Strategy -> click Finish








  7. After choosing the table to generate the Entity from click next -> fill Package name -> tick Generate Name Query... -> click Finish


  8.  

    NetBeans generates all the Entity classes based on the database table that you have chosen. The next thing that we want to do is generate a set of ReSTful web services from the generated Entity classes. Again, NetBeans facilitates the work for us (it is important that you also know how to create the classes manually or you will not know how to debug them if there is any problem in the future).

  9. Right click on the project name "WebApplication" -> RESTful Web Services from Entity Classes... -> Choose the Entity Classes that you would like to generate the WS for and click add or add all -> click next -> on the following screen, accept the default values and click Finish




  10. You can go ahead and test your ReSTFul Web Services by right clicking on the name of the application and click on Test RESTful Web Services




  11. The previous step will launch your web browser within which you can test your web services (click on the node on the left and see the queries on the right)




  12. Back in the NetBeans IDE; right click on the project name "WebApplication" -> click on JSF Pages from Entity Classes... (The JSF pages will not use the web services as there are packaged together with the Entity Classes. This will improve performances and still allow external applications to integrate). Choose the Entity Classes that you would like to generate the pages for -> click next. On the final screen, fill in the package name for the JPA Controller and JSF Classes -> click finish




    NetBeans will generate the necessary files to create a CRUD application with a user interface. I suggest that you familiarize yourself with the generated code.



  13. Expand the Configuration folder under your project name "WebApplication" and the web.xml file. At around line 38, change the content of the welcome-file-list to look as follow

    <welcome-file-list>
            <welcome-file>faces/welcomeJSF.jsp</welcome-file>
    </welcome-file-list>
    This will make the generate JSF page to be the landing page for the application when requested. Make sure that you do have a "welcomeJSF.jsp" file before making the change.



  14. Right click on the application name -> Run. The application should load in your web browser. Now go on, play around with the application. And why not create a client to send request to the web services? (not today)


You can load test your application by using Apache JMeter. It is easy to run and configure. If you want to take a look at how JPA implements the ACID features, browse to your controller classes. Here is a short introduction to JPA transaction. Hope you enjoyed and if you need any clarification, just leave me a comment and try to get back to you ASAP (if time permits).
  • Blogger Comments
  • Facebook Comments

68 comments :

  1. So... basically, this is a tutorial on how to use the NetBeans RAD features. I am not seeing anything about "high transaction" web applications. Guess you get what you paid for.

    ReplyDelete
  2. @Ara, NetBeans RAD features are useful in creating high transaction web app. High transaction web app if updating a DBMS system, need to make sure that they implement all the ACID features correctly. If you run the tutorial and take a look at the "controller" classes, you will see how the code is generate. I am not saying the code generate is bug, actually I said the complete opposite. You have to check your code to make sure that you:

    - open a connection
    - execute the statements
    - commit the changes (transaction)
    - roll back if there's any problem.

    High transaction goes beyond just code and brings in system architecture, caching and data replication.

    This is entry was more about the code side.

    ReplyDelete
  3. This is good written blog and helped me lot to share so many things from here..Thanks for this valuable post.
    web designing company

    ReplyDelete
  4. Hello mates, its wonderful paragraph concerning cultureand completely explained, keep it up all the time. my weblog;
    CMS developer London

    ReplyDelete
  5. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! Webdesign

    ReplyDelete
  6. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Webdesign

    ReplyDelete
  7. This is such a great resource that you are providing and you give it away for free. Webdesign

    ReplyDelete
  8. Webdesigner waar u een professionele en betaalbare website kan laten maken? De nr. 1 webdesigner in Limburg, Antwerpen en Vlaams-Brabant voor SEO websites. Webdesigner

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Nice information and great. Thanks for sharing with us. Great job. If you want to see a collection of xcritical software visit our site

    ReplyDelete
  11. I quickly got this feeling of debilitation since I felt like none of my stuff was anyplace close comparable to that. Webdesign

    ReplyDelete
  12. Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.
    java software outsourcing company ukraine

    ReplyDelete
  13. There are still dissertation website pages utilizing the online as you end up evidently says as part of your webpage. distinct sql

    ReplyDelete

  14. are you looking for web development company then click

    web development company in USA

    either you are looking for mobile app development then click

    Mobile app development company in USA

    either you are looking for cloud services then click

    cloud services provider company in USA

    either you are looking for Artificial Intelligence services then click

    Artificial Intelligence services provider company in USA

    ReplyDelete
  15. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. Web design

    ReplyDelete
  16. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. latest web series

    ReplyDelete
  17. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts.cursus zelfstandig ondernemer

    ReplyDelete
  18. It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. cloud hosting

    ReplyDelete
  19. Jab Apki Gallery Ya Mobile Phone Se Photo Deleted Ho Jaati Hai Tab Aap Badi Asani Se Wapas Recovey Kar Shkte Hai Use Leaye Aap Ye Post Pad Shkte Hai Delete Photo Wapas Kaise Laye Saath Hi Ager Aap Jana Chate Hai My Name Ringtone Maker Ke Baare Mai Tho Aap Badi Asani Se Tho Ye Post Pad Shkte Hai Apne Naam Ki Ringtone Kaise Banaye

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. Likewise your internet design is the very first impression of your site.The best internet design and development companies highly concentrate on their
    approach.find out here

    ReplyDelete
  22. According to Google Algorithm 2017, a site ought to be ResponsiveWebsite. Our eCommerce websites give you the ability to sell your goods and
    services via various retail channels.
    hire a web designer

    ReplyDelete
  23. I'd be trampled if all sites webdesign agencies gave articles like these awesome articles.

    ReplyDelete
  24. software testing company in India
    software testing company in Hyderabad
    Thanks for sharing such a valuable information with us about Develop High Transaction Web Applications with Java MySQL & NetBeans.
    please keep sharing.

    ReplyDelete
  25. I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... sayapro checker

    ReplyDelete
  26. Wohh just what I was looking for, regards for posting.
    ข้อดีUFASLOT

    ReplyDelete
  27. Also, a survey showed user satisfaction. This easy partnership brought about impactful changes, making the system more user-friendly and efficient.
    companies that make logos

    ReplyDelete
  28. Admiring the time and effort you put into your blog and detailed information you offer! Glad to chat your blog, I seem to be forward to more reliable articles and I think we all wish to thank so many good articles, blog to share with us. Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more . i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me 먹튀검증

    ReplyDelete
  29. Heya! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no back up. Do you have any solutions to protect against hackers?| 토토사이트주소

    ReplyDelete
  30. Hey buddies, such a marvelous blog you have made I’m surprised to read such informative stuf
    android app agency

    ReplyDelete
  31. This blog is further than my expectations. Nice work guys!!!
    best brand agencies

    ReplyDelete
  32. Newstyle Print offers high end, low cost banner printing in the UK 먹튀검증사이트

    ReplyDelete
  33. Nice to be visiting your blog once more, it has been months for me. Well this article that ive been waited for therefore long. i want this article to finish my assignment within the faculty, and it has same topic together with your article. Thanks, nice share. I wanted to thank you for this in your liking ensnare!! I particularly enjoying all tiny little bit of it I have you ever bookmarked to check out delivered stuff you pronounce. The blog and data is excellent and informative as well . 먹튀지구대

    ReplyDelete
  34. I want to to thank you for this great read!! I definitely loved every bit of it. I've got you saved as a favorite to check out new things youI’ve been surfing online more than 2 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the internet will be a lot more useful than ever before. 안전놀이터모음

    ReplyDelete
  35. I want to to thank you for this great read!! I definitely loved every bit of it. I've got you saved as a favorite to check out new things youI’ve been surfing online more than 2 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the internet will be a lot more useful than ever before. 토토사이트

    ReplyDelete
  36. I’ve been surfing online more than 2 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the internet will be a lot more useful than ever before. 먹튀검증

    ReplyDelete
  37. So lot to occur over your amazing blog. Your blog procures me a fantastic transaction of enjoyable.. Salubrious lot beside the scene..I’ve found every article I’ve read very helpful. Good one, and keep it goingHello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. 먹튀검증

    ReplyDelete
  38. I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. Wonderful blog post. This is absolute magic from you! I have never seen a more wonderful post than this one. You've really made my day today with this. I hope you keep this up! You completed a number of nice points there. I did a search on the issue and found nearly all people will have the same opinion with your blog. 카디즈에이전시

    ReplyDelete
  39. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post. I will really appreciate the writer's choice for choosing this excellent article appropriate to my matter.Here is deep description about the article matter which helped me more. I see some amazingly important and kept up to length of your strength searching for in your on the site 온카맨

    ReplyDelete
  40. I appreciate this article for the well-researched content and excellent wording. I got so interested in this material that I couldn’t stop reading. Your blog is really impressiv 토토커뮤니티

    ReplyDelete
  41. howdy! This article couldn't be written lots better! Searching through this article rings a bell in my memory of my previous roommate! He usually kept preaching approximately this. I'm going to deliver this article to him. Fairly sure he could have a extraordinary observe. Thanks for sharing! Excellent day, i think your weblog may be having browser compatibility issues. As soon as i test your blog in safari, it looks wonderful but at the same time as starting in i. E., it has some overlapping issues. I just favored to present you a short heads up! Except that, high-quality web page! Spot on with this write-up, i definitely feel this top notch website desires a high-quality deal extra interest. I’ll probably be returning to look at via more, thank you for the statistics! Aw, this became a really proper publish. Taking the time and real try to create a very good article… however what am i able to say… i positioned topics off a whole lot and do now not manage to get nearly something performed. 먹튀검증

    ReplyDelete
  42. great to be here in your article or post, whatever, I figure I ought to likewise buckle down for my own site like I see some great and refreshed working in your site. The post is very amazing around the world many people want to read this type of post I am also part of them and after the reading give good reviews . There is such a great amount in this article I could never have thought of alone. Your substance gives perusers things to consider in a fascinating way. 해피머니상

    ReplyDelete
  43. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article. 토토제작

    ReplyDelete
  44. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. 바카라사이트

    ReplyDelete
  45. "I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article...

    " 토토제작

    ReplyDelete
  46. Great article and a nice way to promote online. I'm satisfied with the information that you provided 먹튀폴리스

    ReplyDelete
  47. Hi, I log on to your new stuff like every week. Your humoristic style is witty, keep it up canaan avalon 1166 pro

    ReplyDelete
  48. Catawbas break ground on $300M Vegas-like 안전공원 먹튀검증사이트웹툰미리보기 해외안전놀이터추천 in Kings Mountain

    ReplyDelete
  49. GTA Online: The Diamond 사설토토사이트 스포츠토토커뮤니티 사설놀이터추천 & Resort

    ReplyDelete
  50. Very neat article post.Really looking forward to read more. Cool. 꽁머니

    ReplyDelete
  51. This was really an interesting topic and I kinda agree with what you have mentioned here! 출장홈타이

    ReplyDelete
  52. definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! 먹튀검증

    ReplyDelete
  53. Thanks, I have been hunting for details about this subject for ages and yours is the best I ave found so far. 토토커뮤니티

    ReplyDelete
  54. This article was written by a real thinking writer. I agree many of the with the solid points made by the writer. I’ll be back. social media management australia

    ReplyDelete
  55. I simply want to tell you that I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. Cheers for sharing with us your blog. 메이저사이트

    ReplyDelete
  56. "Thanks so much for the post.Much thanks again. Awesome.

    " 슬롯사이트

    ReplyDelete
  57. All your hard work is much appreciated. Nobody can stop to admire you. Lots of appreciation. 먹튀검증

    ReplyDelete
  58. I think this is a sublime article, and the content published is fantastic. This content will help me to complete a paper that I've been working on for the last 2 weeks. It was a difficult 2 weeks, but I am glad the work is done now. 온라인바카라

    ReplyDelete
  59. Great article and a nice way to promote online. I'm satisfied with the information that you provided 꽁머니

    ReplyDelete
  60. I have a hard time describing my thoughts on content, but I really felt I should here. Your article is really great. I like the way you wrote this information 먹튀검증

    ReplyDelete
  61. "Hello, just wanted to tell you, I loved this blog post. It was helpful.
    Keep on posting!" 먹튀검증

    ReplyDelete
  62. "Hello, just wanted to tell you, I loved this blog post. It was helpful.
    Keep on posting!" 출장마사지

    ReplyDelete
  63. wow... what a great blog, this writter who wrote this article it's realy a great blogger, this article so inspiring me to be a better person 스마일주소

    ReplyDelete
  64. I ve been recommended this site by an acquaintance.I hope it helps. 먹튀검증사이트

    ReplyDelete
  65. It s my great luck to find this place. I ll visit today and tomorrow. Thank you. 메이저사이트

    ReplyDelete
  66. The cool things here. I am very satisfied to see. Thank you for your writing. 토토

    ReplyDelete

Item Reviewed: Develop High Transaction Web Applications with Java MySQL & NetBeans Description: Rating: 5 Reviewed By: Unknown
Scroll to Top