My class Role.java is listed up in my first post. Here is how I initialize my
database with a role. Notice that morphia does all the mapping and
referencing for us just as JPA / Hibernate do. So you need not do that
yourself.

Role role = ds.find(Role.class, "name", user.getName()).get(); //
permissions are automatically mapped by morphia to the corresponding role
        if (role == null) {
            role = new Role(user.getName());
            *role.getPermissions().add(new WildcardPermission("*:*:*"));*
            role.setTenantId(user.getTenantId());
            *ds.save(role);*
        }



--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Example-Shiro-MongoDB-Realm-tp7579029p7579413.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to