users@glassfish.java.net

Rethinking use of _at_ApplicationScope

From: <glassfish_at_javadesktop.org>
Date: Thu, 16 Sep 2010 20:56:00 PDT

I don't have a lot of experience with IoC, but I think I have a good structure for my application's use of JPA 2.0. For every @Entity bean, I have a @Model annotated "control" bean that has all the functions I use for querying and updating those entities.

The control bean has no state in it other than the PersistenceContext and the EntityManager, which are injected for me. (nice).

My question is why would I not annotate this control bean as @ApplicationScope? Since it has no state, and only on persistence context is in use, I could have thousands of sessions all using one instance, instead of each session or each request having its own. Is there any downside to doing this? It may just be my lack of experience but I don't see it.

Much thanks for any sage advice.
[Message sent by forum member 'alan94539']

http://forums.java.net/jive/thread.jspa?messageID=483016