package devopsdistilled.operp.server.data.entity.party;

import java.util.Date;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import devopsdistilled.operp.server.data.entity.Entiti;
import devopsdistilled.operp.server.data.entity.commons.ContactInfo;

@MappedSuperclass
public abstract class Party extends Entiti<Long> {

	private static final long serialVersionUID = 5183636412272320506L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long partyId;

	private String partyName;

	private String panVat;

	@OneToOne
	private ContactInfo contactInfo;

	@Temporal(TemporalType.DATE)
	private Date registerdDate;

	public Long getPartyId() {
		return partyId;
	}

	public void setPartyId(Long partyId) {
		this.partyId = partyId;
	}

	public String getPartyName() {
		return partyName;
	}

	public void setPartyName(String partyName) {
		this.partyName = partyName;
	}

	public String getPanVat() {
		return panVat;
	}

	public void setPanVat(String panVat) {
		this.panVat = panVat;
	}

	public ContactInfo getContactInfo() {
		return contactInfo;
	}

	public void setContactInfo(ContactInfo contactInfo) {
		this.contactInfo = contactInfo;
	}

	public Date getRegisterdDate() {
		return registerdDate;
	}

	public void setRegisterdDate(Date registerdDate) {
		this.registerdDate = registerdDate;
	}

	@Override
	public Long id() {
		return getPartyId();
	}

	@Override
	public String toString() {
		return new String(getPartyId() + ": " + getPartyName());
	}
}

@@ -70,24 +70,62 @@
 util.Date;%0A%0A
+import javax.persistence.CascadeType;%0A
 import javax
@@ -782,16 +782,43 @@
 OneToOne
+(cascade = CascadeType.ALL)
 %0A%09privat
@@ -893,24 +893,25 @@
 ate register
+e
 dDate;%0A%0A%09pub
@@ -1458,24 +1458,25 @@
  getRegister
+e
 dDate() %7B%0A%09%09
@@ -1482,32 +1482,33 @@
 %09return register
+e
 dDate;%0A%09%7D%0A%0A%09publ
@@ -1522,24 +1522,25 @@
  setRegister
+e
 dDate(Date r
@@ -1542,24 +1542,25 @@
 ate register
+e
 dDate) %7B%0A%09%09t
@@ -1567,24 +1567,25 @@
 his.register
+e
 dDate = regi
@@ -1588,16 +1588,17 @@
 register
+e
 dDate;%0A%09

Set cascade for ContactInfo