Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.castlesbattles.model.to;
- import javax.persistence.*;
- /**
- * Created by Reza on 1/29/2016.
- */
- @Entity
- @Table(name = "message", schema = "castles_battles", catalog = "")
- public class MessageEntity {
- private int id;
- private String body;
- private int coinQuantity;
- private boolean claimed;
- private int playerId;
- PlayerEntity player;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- @Basic
- @Column(name = "body", nullable = true, length = 2048)
- public String getBody() {
- return body;
- }
- public void setBody(String body) {
- this.body = body;
- }
- @Basic
- @Column(name = "coin_quantity", nullable = true)
- public int getCoinQuantity() {
- return coinQuantity;
- }
- public void setCoinQuantity(int coinQuantity) {
- this.coinQuantity = coinQuantity;
- }
- @Basic
- @Column(name = "claimed", nullable = true)
- public boolean isClaimed() {
- return claimed;
- }
- public void setClaimed(boolean claimed) {
- this.claimed = claimed;
- }
- @Basic
- @Column(name = "player_id", nullable = false)
- public int getPlayerId() {
- return playerId;
- }
- public void setPlayerId(int playerId) {
- this.playerId = playerId;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- MessageEntity that = (MessageEntity) o;
- if (id != that.id) return false;
- if (coinQuantity != that.coinQuantity) return false;
- if (claimed != that.claimed) return false;
- if (playerId != that.playerId) return false;
- if (body != null ? !body.equals(that.body) : that.body != null) return false;
- return true;
- }
- @Override
- public int hashCode() {
- int result = id;
- result = 31 * result + (body != null ? body.hashCode() : 0);
- result = 31 * result + coinQuantity;
- result = 31 * result + (claimed ? 1 : 0);
- result = 31 * result + playerId;
- return result;
- }
- @ManyToOne
- @JoinColumn(name = "player_id", referencedColumnName = "id", nullable = false)
- public PlayerEntity getPlayer() {
- return player;
- }
- public void setPlayer(PlayerEntity player) {
- this.player = player;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement