users@glassfish.java.net

Re: example of EntityManager in a war file ?

From: NBW <emailnbw_at_gmail.com>
Date: Thu, 25 Feb 2010 12:09:06 -0500

Felipe take a look at this blog from Arun [1], it builds on a few
others and includes using an EntityManager with JSF. I'd also add that
you could change his example from using an Application-Managed
EntityManager to a Container-Managed EM with a JTA data source. If you
do that you'd get rid of the EntityManagerFactor and inject
@PersistenceContext EntityManager myEM; and you would of course get
container managed transactions for free. You could also refactor
things to delegate to a SLSB and have your JSF ManagedBean inject it
to keep your presentation concerns further separated. You can also
replace the ManagedBean with a @Named CDI 'bean'. Lots of ways to
slice and dice things.

-Noah

2010/2/23 Felipe Gaścho <fgaucho_at_gmail.com>:
> I need a good example of EntityManager being used by a JSF
> application.. anyone ?
>
> --
> ------------------------------------------
>   Felipe Gaścho
>   10+ Java Programmer
>   CEJUG Senior Advisor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>