package uk.ac.edukapp.model;

import java.util.List;

import javax.persistence.*;

import uk.ac.edukapp.model.Userrole;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * The persistent class for the useraccount database table.
 * 
 */
@Entity
@Table(name = "useraccount")
public class Useraccount {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(unique = true, nullable = false)
	private int id;

	@Column(nullable = false, length = 100)
	private String email;

	@Column(nullable = false, length = 256)
	private String password;

	@Column(nullable = false, length = 20)
	private String username;

	@Column(nullable = false, length = 256)
	private String salt;

	@Column(nullable = false, length = 256)
	private String token;

	// bi-directional many-to-many association to Userrole
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "useraccount_roles", joinColumns = { @JoinColumn(name = "user_id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "role_id", nullable = false) })
	private List<Userrole> roles;

	@JsonIgnore
	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	@JsonIgnore
	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public Useraccount() {
	}

	@JsonIgnore
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@JsonIgnore
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@JsonIgnore
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public List<Userrole> getRoles() {
		return roles;
	}

	public void setRoles(List<Userrole> roles) {
		this.roles = roles;
	}
}
@@ -792,16 +792,112 @@
 g token;
+%0A%09%0A%09@OneToOne(cascade=CascadeType.ALL)%0A%09@JoinColumn(name=%22id%22)%0A%09private Accountinfo accountInfo;
 %0A%0A%09// bi
@@ -1982,32 +1982,45 @@
 = username;%0A%09%7D%0A%0A
+%09@JsonIgnore%0A
 %09public List%3CUse
@@ -2129,10 +2129,262 @@
 oles;%0A%09%7D
+%0A%0A%09/**%0A%09 * @return the accountInfo%0A%09 */%0A%09public Accountinfo getAccountInfo() %7B%0A%09%09return accountInfo;%0A%09%7D%0A%0A%09/**%0A%09 * @param accountInfo the accountInfo to set%0A%09 */%0A%09public void setAccountInfo(Accountinfo accountInfo) %7B%0A%09%09this.accountInfo = accountInfo;%0A%09%7D
 %0A%7D

create one-to-one association with Accountinfo with accessor methods