0 Replies Latest reply on May 14, 2009 11:17 AM by Nico Wollenzin

    RoleName and Enums

    Nico Wollenzin Newbie

      Hi List,


      I am doing my first steps using the JPA Identity Manager and everything works fine except one little thing.


      When I try to use an Enum as RoleName to easily access these Names I am getting a ClassCastException. (not very surprising ;-) )


      I think I have to extend the login-Method but I have no Idea how.
      Can someone give me a hint how to do that or just explain me that using Enums is a dumb approach.


      My Enum:


      public enum RolleType {
              
              ADMIN  ("admin"),
              MANAGER ("manager"),
              SOMETHINGELSE ("something");
              
              private final String roleName;
              
              RolleTyp(String roleName) {
                      this.roleName = RoleName;
              }
              
              public String getRoleName() {
                      return RoleName;
              }
      }
      



      My Entity:


      (...)
      @RoleName
      @Enumerated(EnumType.STRING)
      public RolleType getRoleName() {
              return roleName;
      }
      (...)
      


      thanks


      Nico