On Mar 9, 2008, at 11:41 AM, Mario Kofler wrote:
thanks!
unfortunately i cannot wait til it is coming in a release. the
problem i have got now is that my SFSB implements Serializable but i
still keep getting the error!!! very unfortunate.
i realized that the error is not coming after accessing the SFSB but
just after accessing the method that writes the beans to the database.
Do also the Entity beans have to implement Serializable? or do i
have to do something for the entity manager which is created in this
function?
Holding the EntityManager itself is fine, it essentially stays in
memory and only a reference to it is serialized. With the Entities
themselves an actual copy of the object is serialzied to disk.
Optimally, you assume the EntityManager has good caching so you don't
need to keep N copies in X numbers of stateful beans in serialized
form on disk. Just keep track of the minimal amount of information
you need to grab your Entities again from the EntityManager (and it's
live cache) when you activate.
You could implement serializable on your Entity beans, but it's ill
advised in almost any situation to have the data passivated with your
bean as you wind up with a private, detached, copy of the data that
may be outdated. The rare case may be that you're collecting data
that has yet to be persisted (never been attached) and therefore
doesn't live in the EntityManager's cache or database yet, but even
then you should really be using a transaction which would prevent your
bean from getting passivated at all so the issue should never arise.
-David