add ebean models (unused for now)

This commit is contained in:
Lennart ten Wolde 2016-06-13 21:39:03 +02:00
parent 89ab5a8680
commit d3b25411b1
3 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,86 @@
package com.lenis0012.bukkit.marriage2.internal.data.models;
import javax.persistence.*;
@Entity
@Table(name="marriage_players")
public class LocationModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(unique = true, updatable = false)
private int id;
@Column
private String world;
@Column
private double x;
@Column
private double y;
@Column
private double z;
@Column
private float yaw;
@Column
private float pitch;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getWorld() {
return world;
}
public void setWorld(String world) {
this.world = world;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
public float getYaw() {
return yaw;
}
public void setYaw(float yaw) {
this.yaw = yaw;
}
public float getPitch() {
return pitch;
}
public void setPitch(float pitch) {
this.pitch = pitch;
}
}

View File

@ -0,0 +1,37 @@
package com.lenis0012.bukkit.marriage2.internal.data.models;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
@Entity
@Table(name = "marriage_players")
public class MarriageModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(unique = true, updatable = false)
private int id;
@Column(updatable = false, length = 128)
private String player1;
@Column(updatable = false, length = 128)
private String player2;
@ManyToMany
@JoinTable
private List<PlayerModel> players;
@Column
private boolean pvpEnabled = true;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name="home_id")
private LocationModel home;
@Column
private Timestamp marriedAt = new Timestamp(System.currentTimeMillis());
@Version
private long version;
}

View File

@ -0,0 +1,10 @@
package com.lenis0012.bukkit.marriage2.internal.data.models;
import javax.persistence.ManyToMany;
import java.util.List;
public class PlayerModel {
@ManyToMany(mappedBy = "players")
private List<MarriageModel> marriages;
}