• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Good Tutorial? Good Example? of a CRUD application

 
Ranch Hand
Posts: 124
4
MySQL Database Clojure Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am designing/building my first application that interfaces with a DB. I am building this on my laptop using Netbeans and accessing a MySQL DB on our company cloud. The application will also live on the company cloud in a Tomcat environment. I chose Netbeans because there seems to be lots of tutorials and how-to's associated with it, but many of them are dated and most of them have small buggy things in them that you have to resolve. Anyway, what I am looking for is an example that assumes that you might actually want to build an application that will be uploaded to some sort of host environment (Like Cloud Foundry... anything like that) instead of building little examples on my laptop all day long.

I have my application almost done, but I have rebuilt it about four times for various reasons. It is overdue and there is a final due date imposed which is 12 days away. I might even lose my job over this, but where else does one get experience. I raised my hand and said I could do it. There is so much frustration with building this stuff because there is no standard that you can look to for advice. At work, I just don't have the people around me to support me. Imagine building something like this in a vacuum. It's like driving a car and then getting locked in a garage and forced to build a car. You know what it does, how to drive it, all that, but you will have to reinvent everything from scratch because you have no access to the engineer. I am convinced after the last three months that the only real support one can depend on is another developer or a group of developers that support their junior developers.

So, does anyone know of a great tutorial, book, example that one could use a reference. I mean, I don't want to use Derby as my DB because I have to use MySQL - but the details of substituting one DB for another in these Netbeans examples, books, etc. don't really exist. When I hit these problems it takes days to solve them when I know for a fact that with the right info it could be solved in about 15 minutes. I know this is a bit vague but was just hoping someone had a great CRUD example that wasn't just a simple app that you build on your laptop with the idea that it'll never live in the real world.

Thanks!
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you looked at Spring MVC? It's not my area of expertise, but Spring is very widely used, mature and pretty well documented. It should also be fairly straightforward to deploy to cloud platforms like Heroku or Cloudfoundry, and you should be able to find tutorials online to help you.
 
chris webster
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added this thread to the Java In General forum, as you might get some more expert answers there. Good luck!
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Blake Edward wrote:It is overdue and there is a final due date imposed which is 12 days away...


And that would be my worry. With the best will in the world, you aren't going to learn a new framework - even one as mature as Spring - in 12 days. Let alone re-write AND TEST all the stuff you've already done.

My advice would be to try to explain exactly what you've said here to someone sympathetic where you work, because my suspicion is that you're not going to get this done on time - and better they know now than then. If you're honest and say that you've bitten off more than you can chew, and can show them that you haven't been idle, and they still fire you, then perhaps you weren't working in the right place.

However, for future reference, the best thing would have been to warn them a month or two ago, when you started having worries about making the target date. Companies - unless they're complete bastards - can make allowances for target slippage when they have good warning; but not at the last minute.

Sorry if I sound negative, but I suspect you have a human (ie, perception) problem to solve before your programming one.

HIH

Winston
 
Blake Edward
Ranch Hand
Posts: 124
4
MySQL Database Clojure Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Blake Edward wrote:It is overdue and there is a final due date imposed which is 12 days away...


And that would be my worry. With the best will in the world, you aren't going to learn a new framework - even one as mature as Spring - in 12 days. Let alone re-write AND TEST all the stuff you've already done.

My advice would be to try to explain exactly what you've said here to someone sympathetic where you work, because my suspicion is that you're not going to get this done on time - and better they know now than then. If you're honest and say that you've bitten off more than you can chew, and can show them that you haven't been idle, and they still fire you, then perhaps you weren't working in the right place.

However, for future reference, the best thing would have been to warn them a month or two ago, when you started having worries about making the target date. Companies - unless they're complete bastards - can make allowances for target slippage when they have good warning; but not at the last minute.

Sorry if I sound negative, but I suspect you have a human (ie, perception) problem to solve before your programming one.

HIH

Winston



I think your response is right on target. Honesty is not negativity.

As for me... I have been honest too. Haven't hid anything from anybody, but my management team just plods along like I said nothing. We are an embedded bunch of contingent workers (we work for another company, have real benefits, long term employment as long as our hosts are happy with us) that work within a very large global corporation. Someone that works for us found this app to build, which is actually out of scope for our group since we do front end design and development. I got chosen/asked because I had front end skills, was already managing a SQL DB (just managing, nothing terrifically hard, but able to write my own queries), had my nose in Java, AND I was the only developer that we employ out of three that has good communication skills. The job requires constant one-on-one meetings with the client and I have managerial experience from a previous job. Even the client knows where we are at.

I'm not far away from being done. I have the user side finished: The users can view the DB info in a custom designed, password protected environment that I built/designed myself. Using jQuery they can sort, search and filter to their hearts delight. The admin side has been much harder as it has morphed several times from a naive beginner's concept into the latest version where a pure modular concept that gives the admins windows to display, create, edit the information. Based on research and another post that was properly answered here on the Ranch I decided the best course of action was to build two apps. Forget about trying shoehorn the admin part into the finished user part.

Last Wednesday I started the fourth version of the admin part this late in the game, keeping my code and presentation separate, making things modular/reusable, and thinking ahead to the next person that might have to deal with my code. I am not going to cave in and deliver junk. My original MVC diagram was with the best intentions, but it's funny how if you don't have support, code reviews, scrums, a mentor, that you'll probably get off track. Anyway, yesterday (working from home on Saturday, not getting paid) I was able to finally see my admin window pop up and see that it contains the data from the database that I already have sitting in the cloud. That was a huge success for me. I actually think I might get this done. But even if I don't and even if I was to fail and lose my position, this is some of the best experience I could have ever gotten. I have had to not only learn about keystores, MVC design, SSL certs, DB connectivity, application building and project management, not to mention I do all the photoshop work and front end work... but I have had to succeed at all of these things to get this far, and I have done it alone. I can see myself rebuilding this one as a personal project just to get it right, see where it could be better. I might make a DB for my record albums and create a nice interface for myself that way I would always have the code for a project like this in my back pocket.

I have a nice bottle of Swiss wine waiting for the day this is done or the day they let me go. Either way it will be a celebration and I am so much more employable now than I was three months ago.

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It might be a little too late for this project, but I would probably use Spring for such an application.

As already mentioned, Spring is well-documented, very mature, widely used and you'll find plenty of tutorials/guides you can follow from start to finish to get started with one of its projects/parts. And Spring has with Spring Initializr and Spring Boot two awesome goodies to boost your productivity. With the first one you can select with a few mouse clicks which technologies you want to use (e.g. I want a web application using JPA, JDBC, caching, MySQL database and security) and you get a ZIP file containing a Maven (or Gradle) configuration with all necessary dependencies. With the latter one convention over configuration is key and lets you create stand-alone Spring based Applications that you can "just run".
But both require definitely some Spring knowledge as well, certainly if you have to troubleshoot an issue. As long as everything is working out-of-the-box all is peachy But when something is not working as you expected, you definitely need the Spring knowledge to figure it out. Once you are a bit familiar with Spring, you'll notice how you can really focus on implementing business logic because it provides so much functionality for you. For example using JdbcTemplate you don't have to worry about creating a Connection, creating a Statement, creating a ResultSet, iterating through this ResultSet,... You just have to focus on the query, the parameters and how to convert a record into an object. Another example: if you decide to use JPA and use Spring Data as well, you can easily create some methods for database access. You only need this interface (no implementation required )And you'll get a bunch of generic CRUD methods that allows retrieving a User (on id), saving Users, deleting them and so on. And you can even introduce paging functionality (if you want).
 
Blake Edward
Ranch Hand
Posts: 124
4
MySQL Database Clojure Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it's too late. But maybe I can rebuild it with Spring and learn something. Today went unusually smooth and stuff got done. Scary!
 
chris webster
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Blake Edward wrote:Yes it's too late. But maybe I can rebuild it with Spring and learn something...


And if you do, you'll find it a lot easier this time around, because you already understand much more clearly what you want to do, so you just need to figure out how to do it with Spring.

Good luck - hope your bosses recognise your hard work after all.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And I think it's also very difficult to find a (very) good tutorial about creating a CRUD application using exactly the same technologies/frameworks/libraries as you are using. So you'll probably have more luck if you are looking for tutorials about specific parts of your application. So if you want to use JDBC, look for a good tutorial about JDBC to learn how to get a Connection, execute a query, update/delete some records using a prepared statement, closing used resources, and so on. After a quick Google search I have noticed it's even very hard to find a recent, up-to-date JDBC tutorial. Many of the code snippets still use a Class.forName(); statement while this is not required anymore if you use a JDBC 4.0 driver. Other code snippets still manually close the resources instead of using a try-with-resources statement (from Java 7 and later). And the same will apply to creating a front-end using Servlets and JSPs and other topics too.

So it even might be better and save you some (precious) time by just asking a question (or two) in the appropriate forum about code quality, best practices or an issue/problem you are experiencing. This Java community has very knowledgeable people in different areas of Java (and/or software) development and are very keen to help/guide you and even provide advice about your overall code quality and/or best practices which might even not be directly related to the issue you are experiencing.
 
Blake Edward
Ranch Hand
Posts: 124
4
MySQL Database Clojure Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The people that answer the questions here are just great! There is a lot of indecisiveness when making your first application and sometimes you need to be shoved in the right direction. I decided when I took this task on that I wasn't going to be afraid to fail and that I would try to do it right, and that is all. It's been a great learning experience. I think it's going to work out. I'll be glad when it's done and I can go back and look at my mistakes and then just move on to the next thing.
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Blake Edward wrote:I decided when I took this task on that I wasn't going to be afraid to fail and that I would try to do it right, and that is all.


This is important. You will learn as much or more from your mistakes as you do from your successes. There will be lots of "learning experiences" along the way, so this is a great attitude. It will carry you far.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic