Mark the field as transient and catch the passivate/activate events to make sure your object is correctly initialized when it is loaded back into memory.
thanks for your reply. Should I use the @Transient (i.e. for entities) or the java-transient ?
I am also accessing another EJB which should be initialized before a PostActivate annotated method is called - however, it seams as if my other bean is null at that point:
another question - is there any way to prevent my bean from being "swapped-out" - ?
Java transient fields. It is possible that @Transient works on the fields, but I don't know.
You are right - injection doesn't seem to be happening during lifecycle methods. I believe it should, but it might be intentional. I'll have to look into it.
I am not that familiar with the jboss annotations to control bean pool sizes. I doubt there is an easy way to say "keep them all in memory". (which is fine because I really don't think that would be a very good policy)