Building a CRUD Application with NetBeans, JPA and JSF
Java remains a fixture in Australian back-end development, powering systems at the big four banks in Sydney, public-service platforms in Canberra, and consultancies across Melbourne and Brisbane. If you are studying at UNSW or just picking the language up, a CRUD project is the cleanest way to see how persistence, presentation and the IDE fit together.
NetBeans ships with built-in wizards that remove most of the boilerplate you would otherwise write by hand. Code completion, server management and visual debugging are integrated, so you can stay inside one window from the first entity class to the final browser test. For developers who work from home over an NBN connection, having everything in a single tool is genuinely useful.
By the end of this article you will have a working project, a connected database, generated JPA entities and a JSF form that lets you list, add, edit and delete records. The finished application runs on GlassFish or any Jakarta EE 9 compatible server. For broader reading on the IDE, the NetBeans Blog keeps a steady stream of practical guides and configuration tips.
A tidy CRUD demo is also a useful portfolio item. Hiring managers regularly skim GitHub before shortlisting, and a small web application speaks louder than a generic CV. The next sections walk through the build step by step.
Setting up the project
Open NetBeans and choose File, then New Project. Select Java Web from the categories list and pick Web Application. Give the project a name such as StudentRegistry and choose GlassFish Server as the target. The wizard creates a standard project structure with a web folder, a source packages folder and a configuration folder.
Make sure the Java version matches the JDK on your machine. On most Australian laptops this will be Adoptium Temurin 17 or an Oracle distribution, both of which integrate cleanly with the IDE. If you deploy to a shared test server, confirm with your team which servlet container they expect; the differences between GlassFish and Payara matter once you start adding security realms.
Connecting to the database
Switch to the Services tab, right-click on Databases and register a new connection. The bundled Apache Derby driver works well for local development, and it lets you work offline when you are on a train between Sydney and Newcastle. If your project already targets MySQL or PostgreSQL, download the matching driver and add it to the project's libraries.
A common pattern in Australian university projects is to keep the schema in version control and let the IDE generate tables from JPA entities. Test the connection before moving on, because a typo in the hostname is the most common reason a freshly built project refuses to start. When you need to look up method signatures later, the JavaDoc generation guide walks through setting up the documentation plugin.
Generating JPA entities
With the connection working, expand the database node, right-click on a table and choose New, then Entity Classes from Database. Select the tables you need, set the package name and let the IDE generate annotated classes. NetBeans adds the @Entity, @Id and @Column annotations and creates a persistence.xml file under the META-INF directory.
Review the generated code before committing it. Field names often need polishing, and you will usually want to add relationships such as @OneToMany or @ManyToOne by hand. Verify the primary key generation strategy fits your database; identity columns are perfect for MySQL, while sequence generators are a better choice for PostgreSQL. Browsing the project categories page can give you ideas for further entities to add.
Building the JSF interface
Create a new package for your managed beans and add a class that exposes the entity operations. The simplest version holds a list of records, a selected record and four methods: create, update, delete and a load routine. Inject the EntityManager through @PersistenceContext and let the container handle the transaction boundaries.
On the presentation side, use a facelets template with a header, a sidebar and a main content area. A data table renders the list, while a small form below it handles editing. The PrimeFaces library is bundled with NetBeans and gives a polished look without much effort, which helps when you are building demos for stakeholders in Melbourne who care about both function and finish.
Running and testing the application
Right-click the project and choose Run. NetBeans starts GlassFish, deploys the WAR and opens the default browser at the application URL. The first request triggers JPA to validate the persistence unit, so a configuration error usually shows up here. Add a record through the form, edit it, delete it, and refresh the page to confirm the changes stick.
It is worth running a smoke test on every supported browser. Many Australian organisations still use older versions of Internet Explorer on internal systems, and a JSF application that looks fine in Chrome can behave differently in legacy environments. The IDE's built-in profiler is useful at this stage; a couple of clicks show which queries are running and whether lazy loading is being triggered.
Where Java development fits in the modern job market
After the application is working, it is natural to wonder what a project like this is worth in employment terms. Java skills are still in steady demand across finance, government and logistics in Australia, and a small CRUD demo goes a long way in an interview. Some developers choose to write about their projects online to build a portfolio, and you can compare the trade-offs of freelance blogging and traditional employment in marketing to see how a similar pattern plays out in a related field.
Extending the stack with complementary services
Once the web interface is solid, you may want to expose the same data through a lightweight JSON endpoint so a mobile client or partner system can consume it. A pure Java approach using JAX-RS is one option, but for quick internal tooling a smaller script can be just as effective. A walkthrough of creating a simple API with Python shows how a short script can publish project statistics without pulling in a full framework.
Recommendations for getting the most out of this workflow
- Install the full NetBeans distribution rather than the smaller bundle, so you have all the EE wizards available from the start.
- Keep your persistence.xml under version control, with JDBC credentials in a separate properties file.
- Use the IDE's "Inspect and Transform" tool to spot unused imports before each commit.
- Test the application on at least two different servlet containers, since behaviour around session replication can vary.
- Document the JPA entities with field-level comments, because colleagues reading your code later will thank you.
- Take advantage of the built-in database tools instead of switching to a separate client for every schema change.
- Schedule a short code-review pass at the end of each tutorial run, even when you are working alone.