Back to project page swazam.
The source code is released under:
MIT License
If you think the Android project swazam listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ac.tuwien.sa13.entity; /*w ww .j av a 2 s . c om*/ import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; @Entity @Table(name = "user") public class User { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private String name; private String password; @OneToMany(fetch = FetchType.EAGER, mappedBy = "user") @Cascade(CascadeType.ALL) private List<Request> requests = new ArrayList<Request>(); @OneToMany(mappedBy = "user") @Cascade(CascadeType.ALL) private List<Transaction> transactions = new ArrayList<Transaction>(); private int tokens; private String token; public User() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public List<Request> getRequests() { return requests; } public void setRequests(List<Request> requests) { this.requests = requests; } public List<Transaction> getTransactions() { return transactions; } public void setTransactions(List<Transaction> transactions) { this.transactions = transactions; } public int getTokens() { return tokens; } public void setTokens(int tokens) { this.tokens = tokens; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); result = prime * result + ((requests == null) ? 0 : requests.hashCode()); result = prime * result + ((token == null) ? 0 : token.hashCode()); result = prime * result + tokens; result = prime * result + ((transactions == null) ? 0 : transactions.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (password == null) { if (other.password != null) return false; } else if (!password.equals(other.password)) return false; if (requests == null) { if (other.requests != null) return false; } else if (!requests.equals(other.requests)) return false; if (token == null) { if (other.token != null) return false; } else if (!token.equals(other.token)) return false; if (tokens != other.tokens) return false; if (transactions == null) { if (other.transactions != null) return false; } else if (!transactions.equals(other.transactions)) return false; return true; } @Override public String toString() { return "User [id=" + id + ", name=" + name + ", password=" + password + ", requests=" + requests + ", transactions=" + transactions + ", tokens=" + tokens + ", token=" + token + "]"; } }