0 Replies Latest reply on Nov 6, 2015 5:36 AM by Marco Panunzio

    Can't query Roles from database

    Marco Panunzio Newbie
      public List<SelectItem> getRolesList() {
         List<SelectItem> items = new ArrayList<SelectItem>();
         List<Role> roleList = identityManager.getQueryBuilder()
         for (Role role : roleList) {
         if (role != null)
        items.add(new SelectItem(role.getName()));
         return items;


      'role' is always null. I tried to test exactly the same method with a List instead, and it works (every (User user : userList)  is correctly found).

      identityManager is @Injected; this is its configuration:


      public class InjectConfiguration {
         private IdentityConfigurationBuilder builder;
         public IdentityConfigurationBuilder getIdentityConfigurationBuilder()   {
         if (builder == null) {
        builder = new IdentityConfigurationBuilder();
         .supportType(User.class, Role.class, Group.class,
         Realm.class, Application.class,
         GroupMembership.class, ApplicationAccess.class)
         PartitionTypeEntity.class, GrantTypeEntity.class,
         GroupTypeEntity.class, RealmTypeEntity.class,
         RoleTypeEntity.class, UserTypeEntity.class,
         return builder;


      I can't imagine what the error should be. First, I thought Roles weren't even saved in my db, but SELECT * FROM RoleTypeEntity denied my doubts. The only other thing I could think about was something like some kind of problem with the injection of IdentityManager , but once again, as I said, testing the method with querying users gave me positive results. Any ideas? Thank you in advantage for the help.