Final Frontier? JPA Code Completion in NetBeans IDE!

Has the final frontier been reached for Java EE 6 tools in NetBeans IDE? In the daily builds for the upcoming NetBeans IDE 7.2, there is now code completion in calls to EntityManager.createNamedQuery of named queries defined within JPA entity classes:

Above, the cursor is between the quotation marks in "em.createNamedQuery". Now all possible named queries are shown, from all entity classes in the application, and as I type the completion box narrows to match the currently entered characters.

Next, what's pretty cool is that if you hold down the CTRL key and mouse over the named query, a small popup appears showing you the SQL query that the named query represents:

When you click the hyperlink above, which is created when CTRL is held down while you mouse over the named query, the underlying entity class opens with the cursor on the line where the named query is defined.

And that's certainly not all. Read the JPA section here to see other JPA-related enhancements that have already been completed:

From my point of view, the tools for creating Java EE 6 applications are now really great, no need to switch between different files anymore to copy bits of code, lots of code generators and popups, handy dialogs and wizards... so what should be developed next in Java EE land in NetBeans IDE? Yes, asking for feedback from anyone reading this. Interested to know what you think!


This is awesome! Any chance of getting JPQL syntax highlighting and maybe a way to debug/execute statements?

Posted by Henry on March 05, 2012 at 04:44 AM PST #

That's really great to have!!!

This is an exciting server side feature.

What about bring the same quality for client side with really improved support for GWT, like visual desginers and RPC development?

I know we have JSF, but it's too heavy and complicated, and GWT is so slim e easy, and with wide spread of HTML 5, GWT will become more and more powerful!!! Beyond that, having GWT will enable NetBeans to be the best cross tablet development platform ever (iOS, Android, Windows Mobile, among others), even more because Adobe Flash is not supported anymore, there is an unique opportunity for NetBeans).


Edson Richter

Posted by Edson Richter on March 05, 2012 at 05:17 AM PST #

Hi Geertjan,

Very cool, indeed! It's wonderful to see how the Netbeans team is tackling those 'edge cases' in version 7. What I mean by edge cases in this context is that 20% of code that takes up 80% of our development time. Just another example why Netbeans rocks.

I'd also rejoice seeing full support in 7.2 for TomEE, the Apache Foundation's OS EE server built on top of Tomcat. Currently Netbeans doesn't recognize its Web Profile as an EE server and complains about numerous missing javax components (especially JPA related due to TomEE use of Open JPA). I am hoping that eventually the experience when working with TomEE in Netbeans will be as seamless as it is currently when working with GlassFish.

Jeff Schwartz

Posted by Jeffrey Schwartz on March 05, 2012 at 06:35 AM PST #

Yes, that's fantastic! NB rules!

I endorse Henry's comment on JPQL code completion and a way to debug/execute JPQL statements in the same manner that is done with SQL statements in Netbeans.

It would be really great.

Posted by Geraldo on March 05, 2012 at 02:46 PM PST #

The new features are great! Way to go!

Are there plans for a Visual JSF Designer and Report Generator in NetBeans X.X to complete the "assembly" of tools?

Posted by guest on March 05, 2012 at 09:14 PM PST #

@Geraldo From what I see the JPQL code completion exists if you look at the New and Noteworthy page here:

What would be nice is syntax highlighting in the editor (so that the named query does not appear as a simple string) and the debug console where I can execute some JPSQL or a named query.

Posted by Henry on March 06, 2012 at 01:56 AM PST #

The new JPA code completion feature looks great - however in many cases the named queries will be kept in orm.xml rather than the entity classes - please could the JPA code completion also show queries loaded from orm.xml?

Posted by Jonathan on March 06, 2012 at 06:18 AM PST #

Having the ability to execute JPQL like SQL would be great.

Tim Troy

Posted by guest on March 09, 2012 at 05:18 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

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.


« September 2016