Saturday Nov 17, 2012

Hibernate, PostgreSQL, Ubuntu, NetBeans IDE (Part 2)

Now let's create the start of a CRUD application on the NetBeans Platform, using Hibernate and PostgreSQL to do so. Here's what I see in NetBeans IDE after setting things up as outlined yesterday:

The NetBeans Platform CRUD Tutorial should get you up and started creating the NetBeans Platform application. Open the generated "persistence.xml" in Design mode and then switch the persistence library to Hibernate. Then the rest should be the same as described in the tutorial.

Here's the application structure I ended up with at the end, with the difference that PostgreSQL and Hibernate are now used instead of Java Derby and EclipseLink:

The Hibernate module that you see above has this content:

Here's the result when I run the application, i.e., the data shown in the first screenshot above is now displayed as Nodes in a TopComponent:

And here's the source code:


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« November 2012 »