Geertjan's Blog

  • March 5, 2012

Final Frontier? JPA Code Completion in NetBeans IDE!

Geertjan Wielenga
Product Manager

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!

Join the discussion

Comments ( 8 )
  • Henry Monday, March 5, 2012

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

  • Edson Richter Monday, March 5, 2012

    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

  • Jeffrey Schwartz Monday, March 5, 2012

    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


  • Geraldo Monday, March 5, 2012

    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.

  • guest Tuesday, March 6, 2012

    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?

  • Henry Tuesday, March 6, 2012

    @Geraldo From what I see the JPQL code completion exists if you look at the New and Noteworthy page here: http://wiki.netbeans.org/NewAndNoteworthyNB72#JPA_Support

    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.

  • Jonathan Tuesday, March 6, 2012

    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?

  • guest Friday, March 9, 2012

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

    Tim Troy

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