}
}
@Factory(value = "newUserDefaultRole", scope = ScopeType.SESSION)
public Role getDefaultRole() {
UserManagementPreferences userPrefs = Preferences.instance().get(UserManagementPreferences.class);
try {
return (Role) entityManager
.createQuery("select r from Role r where r.name = '"+userPrefs.getNewUserInRole()+"'")
.setHint("org.hibernate.cacheable", true)
.getSingleResult();
} catch (NoResultException ex) {
throw new RuntimeException("Configured default role for new users '"+userPrefs.getNewUserInRole()+"' not found");
}
}