Six Essential Java EE 6 Annotations - Sufficient For CRUD
From presentation to backend:
- @Model: (=@RequestScoped + @Named) directly exposes the backing bean into JSF 2 (or JSP)
- @Stateless: declares a POJO as Stateless Session Bean. You will need at least one boundary to manage transactions conveniently.
- @Inject: injects application "components" ("POJOs", Managed Beans, EJBs)
- @PersistenceContext: injects the EntityManager
- @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.
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 #
@Sandeep,
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 :-)
thanks!,
adam
Posted by adam-bien.com on February 08, 2011 at 09:32 PM CET #
Thanks for sharing information dude. its pretty handy to know about this.
Thanks
Javin
Posted by Javin Paul @ Tibco RV Tutorial on February 13, 2011 at 01:41 PM CET #
Adam,
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:
http://blog.kennardconsulting.com/2011/12/you-cant-spell-forge-without-metawidget.html
Regards,
Richard.
Posted by Richard Kennard on December 20, 2011 at 06:05 AM CET #
(and there's some documentation on design decisions here: https://docs.jboss.org/author/display/FORGE/UI+Scaffolding)
Posted by Richard Kennard on December 23, 2011 at 08:32 AM CET #