Geertjan's Blog

  • September 21, 2014

Configure Data Source and GlassFish while Coding in NetBeans

Geertjan Wielenga
Product Manager

I learned a lot from a new YouTube clip by Thomas Stütz, a teacher who uses NetBeans to teach Java at a secondary school in Austria. (A lot more about him here.) It turns out that NetBeans is even better integrated with GlassFish than I thought it was. The @Entity annotation, shown in the YouTube clip by Thomas, gives you access to a series of dialogs for defining the persistence.xml, which also let you define the database itself. Pretty cool. This is a movie well worth watching:

I had a couple of problems following the scenario above on Windows 7. 

  1. Depending on the problems you run into, you may need to play with starting NetBeans, GlassFish, and the registration of GlassFish only after starting NetBeans via "Run as Administrator", as discussed here

  2. Make sure to include a default constructor in the entity class, as mentioned here.

  3. You may need to use the "eclipselink.target-database"="Derby" property in your persistence.xml, as described here
However, in the end, after figuring out various problems via the links above, I was really impressed with the fact that so much can be done directly from the Java Editor in the IDE, via the various yellow lightbulb hints in the left sidebar. Domain-driven development is really possible, when you combine Java EE with NetBeans IDE.

The next YouTube clip in the series by Thomas is focused on WildFly: https://www.youtube.com/watch?v=TxeQLifXv0k

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.