Adam Bien's Weblog

Six Essential Java EE 6 Annotations - Sufficient For CRUD

From presentation to backend:

  1. @Model: (=@RequestScoped + @Named) directly exposes the backing bean into JSF 2 (or JSP)
  2. @Stateless: declares a POJO as Stateless Session Bean. You will need at least one boundary to manage transactions conveniently.
  3. @Inject: injects application "components" ("POJOs", Managed Beans, EJBs)
  4. @PersistenceContext: injects the EntityManager
  5. @Entity (and @Id to denote a PK): make a class persistent

The annotations above are sufficient to start with Java EE 6 and implement a CRUD webapplication with JSR 2, EJB 3.1, CDI, JPA 2.

NEW dates, new workshop: Java EE 7 Workshops: Bootstrap, Effective, Architectures, JavaScript Bootstrap and HTML 5 December, 7th-11th
NEW: Effective Java EE 7 -- Available For Streaming


A book about rethinking Java EE Patterns


The topic says 6 but only 5 are listed.

Anyways, good list

Posted by Sandeep Bhandari on February 08, 2011 at 06:41 PM CET #


thanks! I thought it is fair to also mention @Id. But five annotations would be better from marketing perspective :-).

I got many requests regarding the most "important" Java EE 6 annotations. It was easier to write a post about that :-)



Posted by on February 08, 2011 at 09:32 PM CET #

Thanks for sharing information dude. its pretty handy to know about this.


Posted by Javin Paul @ Tibco RV Tutorial on February 13, 2011 at 01:41 PM CET #


For JBoss Forge we're trying to generate a super clean, pure Jave EE CRUD application. It's an interesting exercise in minimal, best practice design.

I tried to follow your annotations advice but we're encountering a few wrinkles.

I'd be most grateful if you could take a look at our implementation and point us at anything we could improve.

I've posted the generated project as a link at the bottom of my blog:



Posted by Richard Kennard on December 20, 2011 at 06:05 AM CET #

(and there's some documentation on design decisions here:

Posted by Richard Kennard on December 23, 2011 at 08:32 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments