users@glassfish.java.net

Re: Singleton vs. J2EE spec, how to implement a data cache

From: <glassfish_at_javadesktop.org>
Date: Mon, 26 Jan 2009 07:12:31 PST

> I am pretty new to J2EE, but from my basic
> understanding placing singleton cache object
> reference in a stateful/stateless session bean does
> not really make sense.

You're right. The EJB spec does not currently define a construct
that allows for sharing between multiple instances of a bean or
multiple beans in an application. This is why EJB 3.1 will define
a Singleton bean.

http://blogs.sun.com/MaheshKannan/entry/singleton_ejb_support_in_glassfish

The typical workaround in EJB 3.0 applications is to use static state. A resource
adapter would work as well but is more complex to implement.
[Message sent by forum member 'ksak' (ksak)]

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