title: Passing a Enum value as a parameter from JSF
body: <p>I am trying to migrate my existing code to using Enum and I run into some problems due to my lack experience with Enum. First of all here is my structures. In my <code>EJB</code>, alongs with Entity, I have a enum class (not sure if it even a class).</p>
  
  <pre><code>public enum Type {
      PROFILE_COMMENT,
      GROUP_COMMENT
  } 
  </code></pre>
  
  <p>At my managed bean <code>myBean.java</code>, I have </p>
  
  <pre><code>@ManagedBean(name="myBean")
  @SessionScoped
  public class myBean {
  
      private Type type;
  
      public myBean() {
      }
  
      public Type getType() {
          return type;
      }
  
      public void setType(Type type) {
          this.type = type;
      }
  
      public void Test(Type t){
          System.out.println(t);
      }
  
  }
  </code></pre>
  
  <p>then at my JSF, </p>
  
  <pre><code>&lt;h:commandButton value="Test" action="#{myBean.Test(myBean.type.PROFILE_COMMENT)}" /&gt;
  </code></pre>
  
  <p>I got <code>java.lang.ClassNotFoundException:</code> saying <code>Type</code> is not a class  </p>
  
  <p>The reason I have <code>Type</code> in my EJB so that I can create an enumerated type for my Entity, so my query would look like this</p>
  
  <pre><code>select c from X c where c.type = Type.PROFILE_COMMENT
  </code></pre>