[jboss-user] [JBoss Seam] - Re: best way of using application scope constants?

jazir1979 do-not-reply at jboss.com
Wed Jul 4 23:56:30 EDT 2007

I'm doing a similar thing to this using a SLSB with application scoped @Factory methods.  It works well.

  | @Stateless
  | @Name("factory")
  | public class FactoryActionBean extends BaseActionBean implements FactoryAction {
  |     @In(create = true, value = "entityManager")
  |     protected EntityManager em;
  |     /** {@inheritDoc} */
  |     @Factory(value = "statusList", scope = ScopeType.APPLICATION)
  |     public List<Status> getStatuses() {
  |         return  service.findReservationStatuses(em);
  |     }

Watch out though, using the above list with <s:convertEntity/> broke in Seam 2 Beta 1 due to JBSEAM-1487, but this is now fixed in CVS, thanks to Pete.

"bkroeger" wrote : Hi,  I would like to know if Ellen got this working, I have tried to do the same thing but when I attempt to get a reference to the EntityManager in my application scope bean:
  |   | @PersistenceContext
  |   |     private EntityManager em;
  |   | 
  | I get an error message telling me my bean needs to be in session scope, which defeats the purpose as I will end up re-creating my list every time a new session starts.
  | What's the best way to have an application scope (static) list available to the application, that requires use of the EntityManager?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060628#4060628

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060628

More information about the jboss-user mailing list