mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
initial add of EbeanORM server based on v2.8.1
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.avaje.ebean.validation.NotNull;
|
||||
|
||||
@Entity(name = "Phone")
|
||||
@Table(name = "PHONES")
|
||||
public class Phone implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -326610269092956952L;
|
||||
|
||||
private Long id;
|
||||
private String phoneNumber;
|
||||
private Person person;
|
||||
|
||||
public Phone() {
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
|
||||
@Column(name = "ID", unique = true, nullable = false)
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "PHONE_NUMBER", nullable = false, unique = true, columnDefinition = "varchar(7)")
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ManyToOne(targetEntity = Person.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "PERSON_ID", nullable = false)
|
||||
public Person getPerson() {
|
||||
return person;
|
||||
}
|
||||
|
||||
public void setPerson(Person person) {
|
||||
this.person = person;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user