Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.oblivionsoftware.raid.entity;
- /**
- * Imports
- */
- import java.io.Serializable;
- import java.util.Date;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.GenerationType;
- import javax.persistence.Id;
- import javax.persistence.NamedQueries;
- import javax.persistence.NamedQuery;
- import javax.persistence.Table;
- import javax.persistence.Temporal;
- import javax.persistence.TemporalType;
- import javax.xml.bind.annotation.XmlRootElement;
- /**
- * User.
- *
- * @author Dustin Dobervich <ddobervich@gmail.com>
- */
- @XmlRootElement(name="user")
- @Entity
- @Table(name="raid_users")
- @NamedQueries({
- @NamedQuery(
- name=User.FIND_BY_USERNAME,
- query="SELECT u FROM User u WHERE u.username=:username"
- ),
- @NamedQuery(
- name=User.FIND_BY_EMAIL,
- query="SELECT u FROM User u WHERE u.email=:email"
- )
- })
- public class User implements Serializable
- {
- private static final long serialVersionUID = 1L;
- private static final String PREFIX = "User.";
- public static final String FIND_BY_USERNAME = PREFIX + "findByUsername";
- public static final String FIND_BY_EMAIL = PREFIX + "findByEmail";
- @Id
- @GeneratedValue(strategy=GenerationType.SEQUENCE)
- @Column(name="id", nullable=false)
- private int id;
- @Column(name="username", unique=true, nullable=false)
- private String username;
- @Column(name="email", unique=true, nullable=false)
- private String email;
- @Column(name="password", nullable=false)
- private String password;
- @Column(name="salt", nullable=false)
- private String salt;
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="last_login", nullable=false)
- private Date lastLogin = new Date();
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_at", nullable=false)
- private Date createdAt = new Date();
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="updated_at", nullable=false)
- private Date updatedAt = new Date();
- /**
- * Gets the id.
- *
- * @return The id
- */
- public int getId()
- {
- return this.id;
- }
- /**
- * Sets the id.
- *
- * @param id The id
- */
- public void setId(int id)
- {
- this.id = id;
- }
- /**
- * Gets the username.
- *
- * @return The username
- */
- public String getUsername()
- {
- return this.username;
- }
- /**
- * Sets the username.
- *
- * @param username The username
- */
- public void setUsername(String username)
- {
- this.username = username;
- }
- /**
- * Gets the email.
- *
- * @return The email
- */
- public String getEmail()
- {
- return this.email;
- }
- /**
- * Sets the email.
- *
- * @param email The email
- */
- public void setEmail(String email)
- {
- this.email = email;
- }
- /**
- * Gets the password.
- *
- * @return The password
- */
- public String getPassword()
- {
- return this.password;
- }
- /**
- * Sets the password.
- *
- * @param password The password
- */
- public void setPassword(String password)
- {
- this.password = password;
- }
- /**
- * Gets the salt.
- *
- * @return The salt
- */
- public String getSalt()
- {
- return this.salt;
- }
- /**
- * Sets the salt.
- *
- * @param salt The salt
- */
- public void setSalt(String salt)
- {
- this.salt = salt;
- }
- /**
- * Gets the last login date.
- *
- * @return The last login date
- */
- public Date getLastLogin()
- {
- return this.lastLogin;
- }
- /**
- * Sets the last login date.
- *
- * @param lastLogin The last login date
- */
- public void setLastLogin(Date lastLogin)
- {
- this.lastLogin = lastLogin;
- }
- /**
- * Gets the date created.
- *
- * @return The date created
- */
- public Date getCreatedAt()
- {
- return this.createdAt;
- }
- /**
- * Sets the date created.
- *
- * @param createdAt The date created
- */
- public void setCreatedAt(Date createdAt)
- {
- this.createdAt = createdAt;
- }
- /**
- * Gets the date updated.
- *
- * @return The date updated
- */
- public Date getUpdatedAt()
- {
- return this.updatedAt;
- }
- /**
- * Sets the date updated.
- *
- * @param createdAt The date updated
- */
- public void setUpdatedAt(Date updatedAt)
- {
- this.updatedAt = updatedAt;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement