title: Tried deactivating passivation of stateful session bean with @CacheConfig
body: <p>I tried to deactivate passivation of a stateful session bean using </p>
  
  <blockquote>
    <p>@CacheConfig(maxSize = 0, idleTimeoutSeconds = 0)</p>
  </blockquote>
  
  <p><a href="http://docs.jboss.org/ejb3/docs/reference/1.0.7/html/SessionBean_and_MDB_configuration.html" rel="nofollow">http://docs.jboss.org/ejb3/docs/reference/1.0.7/html/SessionBean_and_MDB_configuration.html</a></p>
  
  <p>I added a couple print statements to my stateful session bean and the managed bean that it's injected into to better understand what's happening.  It appears that the stateful bean is indeed injected into the managed bean (as it's not null), but calling it's methods has no effect (if you look at the loadData() method of the managed bean below, it calls the test() routine of the stateful session bean, but the output "test" never appears).</p>
  
  <blockquote>
    <p>15:06:07,861 INFO  [STDOUT] loadData programSlug = some-program-name</p>
    
    <p>15:06:07,876 INFO  [STDOUT] programServiceBean = No-Interface view for endpoint [ jboss.j2ee:jar=TEI.war,name=ProgramServiceBean,service=EJB3 ] and session 43h1h2v-j35uon-h18czgvf-1-h18d0nzj-df</p>
    
    <p>15:06:07,908 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/TEI].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalStateException:
     Unable to locate member [com.ray.TEI.model.Program#urlSlug]
            at org.hibernate.ejb.metamodel.AbstractAttribute.readObject(AbstractAttribute.java:122) [:3.6.6.Final]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_30]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_30]</p>
  </blockquote>
  
  <p>Here is my stateful session bean...</p>
  
  <pre><code>package com.ray.TEI.ejb;
  
  import com.ray.TEI.model.Program;
  
  import javax.ejb.Stateful;
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import javax.persistence.PersistenceContextType;
  
  import org.jboss.ejb3.annotation.CacheConfig;
  
  @Stateful
  @CacheConfig(maxSize = 0, idleTimeoutSeconds = 0)
  public class ProgramServiceBean {
    @PersistenceContext(unitName="TEI", type=PersistenceContextType.EXTENDED)
    protected EntityManager em;
  
    public void test() {
      System.out.println("test");
    }
  
    public Program findBySlug(String urlSlug) {
      System.out.println("findBySlug " + urlSlug);
      return em.createNamedQuery("Program.findBySlug", Program.class)
          .setParameter("urlSlug", urlSlug)
          .getSingleResult();
    }
  }
  </code></pre>
  
  <p>And here is the managed bean...</p>
  
  <pre><code>package com.ray.TEI.controller;
  
  import javax.enterprise.context.RequestScoped;
  import javax.inject.Inject;
  import javax.inject.Named;
  
  import com.ocpsoft.pretty.faces.annotation.URLAction;
  import com.ocpsoft.pretty.faces.annotation.URLMapping;
  import com.ocpsoft.pretty.faces.annotation.URLQueryParameter;
  import com.ray.TEI.ejb.ProgramServiceBean;
  import com.ray.TEI.model.Program;
  
  @Named
  @RequestScoped
  @URLMapping(
    id="uuts",
    pattern="/#{programSlug:uutsController.programSlug}/uuts",
    viewId="/uuts.xhtml"
  )
  public class UutsController {
    @Inject private ProgramServiceBean programServiceBean;
    private String programSlug;
    private Program program;
  
    @URLQueryParameter("new")
    private Boolean displayAddForm = false;
  
    @URLAction
    public String loadData() {
      System.out.println("loadData programSlug = " + programSlug);
      if (programSlug != null) {
        System.out.println("programServiceBean = " + programServiceBean);
        programServiceBean.test();
        program = programServiceBean.findBySlug(programSlug);
        System.out.println("loadData program = " + program.getName());
      }
      if (program == null) {
        return "pretty:error";
      }
      return null;
    }
  
    public String getProgramSlug() {
      return programSlug;
    }
    public void setProgramSlug(String programSlug) {
      this.programSlug = programSlug;
    }
  
    //other getters/setters
  }
  </code></pre>
  
  <p>Any idea of what the problem is?</p>
  
  <p>Thanks,
  Jason</p>
  
  <p>(By the way, I'm using JBoss 6.1 Final)</p>