Adam Bien's Weblog
JSF 2 + JPA 2 + EJB 3.1 Scaffolding With Netbeans 6.8 in 3 Steps - And The Code Is Even Usable
NetBeans 6.8 comes with a new wizard, which generates a JSF 2 application from an existing database using EJB 3.1 and JPA 2. The resulting code is even usable for real world projects. Also interesting: the generator templates can be easily edited directly from the wizard. This is a serious killer feature and really usable. You can apply the wizard to a Java EE 6 WAR project and deploy it to Glassfish v3. For this purpose:
- Create a new WAR application and choose Glassfish v3, Java EE 6 and add JSF 2 as a framework.
- Right mouse click on the WAR and choose: "Entity Classes From Database....", choose an existing DataSource, then a Table and don't forget to push the "Create Persistence Unit" button. The result: a JPA entity + persistence.xml.
- Right mouse click on the WAR and choose: "JSF Pages from Entity Classes..." and choose the even generated JPA entity. On the second page you can even customize the templates (just click on the link in the right bottom corner). This is really useful.
Posted at 09:16AM Oct 02, 2009 by Adam Bien in Netbeans | Kommentare[4]
[my tweets]
Rss My book: Real World Java EE - Rethinking Best Practices


Adam, when Java EE 6 will be officially officially released?
Gesendet von Fábio am October 02, 2009 at 05:01 PM CEST #
Thanks Adam, I really LOVED what you made me discover. But, IMHO, two features are lacking :
- Use of JSF2 @ManagedBean Annotations instead of configuration
- Option to select Facelets generation instead of JSP
Do you know if those features will be developed during the 6.8 timeframe ?
Gesendet von Cédric Marcone am October 07, 2009 at 03:08 PM CEST #
Wow, I just downloaded NB6.8 M2 and I discovered there are facelets generator in this version.
They even generate JSF beans with the @ManagedBean annotation.
Only one feature is lacking on the facelets side : collections are not presented in the edit and view pages.
Congratulations to the NetBean Team, this feature is a real time saver.
Gesendet von Cédric Marcone am October 09, 2009 at 06:45 PM CEST #
Why don't you use Eclipse instead of Netbeans ? :(
Gesendet von bob am October 16, 2009 at 06:31 PM CEST #