This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

UserRole.java

By: a guest on Mar 10th, 2010  |  syntax: Java  |  size: 1.27 KB  |  views: 47  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package com.apress.timesheets.entity;
  2.  
  3. import java.io.Serializable;
  4.  
  5. import javax.persistence.Column;
  6. import javax.persistence.Entity;
  7. import javax.persistence.GeneratedValue;
  8. import javax.persistence.Id;
  9. import javax.persistence.NamedQueries;
  10. import javax.persistence.NamedQuery;
  11.  
  12. @Entity
  13. @NamedQueries({
  14.    @NamedQuery(name="findUserRole",query="from UserRole where roleName = :roleName"),
  15.    @NamedQuery(name="findUserRoles",query="from UserRole order by roleName")
  16. })
  17. public class UserRole implements Serializable {
  18.    public static final String ROLE_ANONYMOUS = "ROLE_ANONYMOUS";
  19.    public static final String ROLE_USER = "ROLE_USER";
  20.    public static final String ROLE_ADMINISTRATOR = "ROLE_ADMINISTRATOR";
  21.  
  22.    private static final long serialVersionUID = 0L;
  23.    private Long id;
  24.    private String roleName;
  25.  
  26.    public UserRole() {
  27.    }
  28.  
  29.    public UserRole(final String roleName) {
  30.       this.roleName = roleName;
  31.    }
  32.  
  33.    @Id
  34.    @GeneratedValue
  35.    public Long getId() {
  36.       return id;
  37.    }
  38.  
  39.    public void setId(Long id) {
  40.       this.id = id;
  41.    }
  42.  
  43.    @Column(nullable = false, unique = true)
  44.    public String getRoleName() {
  45.       return roleName;
  46.    }
  47.  
  48.    public void setRoleName(String roleName) {
  49.       this.roleName = roleName;
  50.    }
  51. }
clone this paste RAW Paste Data