Generating session beans from JPA entities

One very nice NetBeans feature is that it allows the generation of stateless session beans from the existing JPA entities. The generated session beans act as Data Access Objects (DAOs). This feature, combined with the ability to generate JPA entities from an existing database schema, allows us to completely generate the data access layers of our application without having to write a single line of Java code.

To take advantage of this functionality, we need to create an EJB project (go to File | New Project, select Enterprise from the Categories list, select EJB Module from the Projects list), or use the EJB project from an Enterprise Application project and add some JPA entities to it either by manually ...

Get Java EE 7 Development with NetBeans 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.