Guest User

Untitled

a guest
Jun 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. @Entity(tableName = "users")
  2.  
  3. public class UsersEntity{
  4. @PrimaryKey(autoGenerate = true)
  5. private long id;
  6.  
  7. @NonNull
  8. private String name;
  9.  
  10. @NonNull
  11. private long roleId;
  12. }
  13.  
  14. @Entity(tableName = "roles")
  15.  
  16. public class RolesEntity{
  17. @PrimaryKey(autoGenerate = true)
  18. private long id;
  19.  
  20. @NonNull
  21. private String name;
  22. }
  23.  
  24. public class User{
  25. private long id;
  26. private Role role;
  27. }
  28.  
  29. user = userDao.getUser(userId)
  30. user.setRole(roleDao.getRole(user.getRoleId)
Add Comment
Please, Sign In to add comment