2 Replies Latest reply on Oct 18, 2005 5:48 PM by Patrick Angeles

    Transient @In values, stateless beans, etc.

    ryan dewell Novice

      I'm making the following assumptions about injection, and I'm hoping for some confirmation or correction on each:

      1) All @In values can safely be set as transient in most cases, since they will simply be reinjected when the bean is used again.

      2) @Stateless beans can have transient @In values and still safely be considered @Stateless??

      Thanks,

      Ryan

        • 2. Re: Transient @In values, stateless beans, etc.
          Patrick Angeles Novice

          On the same tip,

          Can I mark @PersistenceContext safely as transient? Will it be reinjected on SFSB activation time?

          As it is, not marking the @PersistenceContext variable as transient results in the following error:

          16:37:31,621 INFO [STDOUT] Exception in thread "Timer-3"
          16:37:31,621 INFO [STDOUT] javax.ejb.EJBException: Could not passivate; failed to save state; CausedByException is:
          org.hibernate.ejb.callback.EntityCallbackHandler
          16:37:31,622 INFO [STDOUT] at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:333)
          16:37:31,622 INFO [STDOUT] at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:143)
          16:37:31,622 INFO [STDOUT] at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:92)
          16:37:31,623 INFO [STDOUT] at java.util.TimerThread.mainLoop(Timer.java:512)
          16:37:31,623 INFO [STDOUT] at java.util.TimerThread.run(Timer.java:462)
          16:37:31,623 INFO [STDOUT] java.io.NotSerializableException: org.hibernate.ejb.callback.EntityCallbackHandler
          16:37:31,624 INFO [STDOUT] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
          16:37:31,624 INFO [STDOUT] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
          16:37:31,624 INFO [STDOUT] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
          16:37:31,624 INFO [STDOUT] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)