You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.2 KiB

package com.singlestone.contacts.model;
import javax.persistence.*;
@Entity
@Table(name = "phones")
public class Phone {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "number")
private String number;
@Column(name = "type")
@Enumerated(EnumType.STRING)
private Type type;
@ManyToOne(fetch = FetchType.LAZY)
private Contact contact;
public Phone() {
}
public Phone(String number, Type type) {
this.number = number;
this.type = type;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public Contact getContact() {
return contact;
}
public void setContact(Contact contact) {
this.contact = contact;
}
public enum Type {
home,
work,
mobile
}
}