Advertisement
Noah-Huppert

Scotch User Model V1

Nov 3rd, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. /**
  2.  * Holds User information
  3.  */
  4. @Entity
  5. public class User extends Model{
  6.     /**
  7.      * The users Id
  8.      */
  9.     @Id
  10.     public String userId;
  11.  
  12.     /**
  13.      * The users emails
  14.      */
  15.     @OneToMany(cascade = CascadeType.ALL)
  16.     @Constraints.Required
  17.     public List<UserEmail> emails;
  18.  
  19.     /* Constructors */
  20.     /**
  21.      * Creates a new user
  22.      * @param userId {@link models.User#userId}
  23.      * @param emails {@link models.User#emails}, if null an empty ArrayList will be created
  24.      */
  25.     public User(String userId, List<UserEmail> emails){
  26.         this.userId = userId;
  27.         this.emails = emails == null ? new ArrayList<>() : emails;
  28.     }
  29.  
  30.     /* Actions */
  31.     /**
  32.      * Used to query the database
  33.      */
  34.     public static Finder<Long, User> find = new Finder<Long, User>(Long.class, User.class);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement