0 Replies Latest reply on Jun 3, 2009 1:06 PM by Edem Morny

    Error configuring JpaIdentityStore

    Edem Morny Novice

      I have a problem using Seam's JpaIdentityStore in seam 2.1.1.GA for identity management.


      I have a User class annotated as following



      @Name("user")
      @Entity
      @Table(name="users")
      public class UserImpl extends UniqueIDImpl implements User{
          private static final long serialVersionUID = -7547331292683799836L;
          @UserFirstName
          private String firstName;
          @UserLastName
          private String lastName;
          @UserPrincipal
          private String username;
          @UserPassword(hash="md5")
          private String password;
          @ManyToMany(targetEntity=RoleImpl.class)
          @JoinTable(name="user_role",joinColumns = {@JoinColumn(name = "user_id")},
                          inverseJoinColumns = {@JoinColumn(name = "role_id")})
          @UserRoles   
          private Set<Role> roles = new HashSet<Role>();
      


      And Roles also as ff:


      @Entity
      @Table(name="roles")
      @Name("role")
      public class RoleImpl extends UniqueIDImpl implements Role{
          private static final long serialVersionUID = -7189583948477718346L;
          @RoleName
          private String rolename;  



      You will notice that because I'm implementing from defined interfaces, I had to specify the targetEntity on the ManyToMany relationship and declare annotations on fields and not on properties (get/sets) as I'd have liked to do, simple because I had exceptions otherwise.


      I have specified these in the components.xml file as ff



      <security:jpa-identity-store user-class="com.domain.model.security.UserImpl"
              role-class="com.domain.model.security.RoleImpl"/>



      Somehow, I'm unable to login, though I'm able to create user accounts which are sitting comfortably in the database. I decided to test my configuration by calling


      IdentityManager.instance().createUser("michael", "essien");



      And I get the following exception among other exceptions.





      Caused by org.jboss.seam.security.management.IdentityManagementException with message: Error configuring JpaIdentityStore - it looks like you're using a cross-reference table, however the user property cannot be determined.

      Any ideas what I'm doing wrong?