package com.lyubenblagoev.postfixrest.entity;

import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name="domains")
public class Domain extends BaseEntity {
	
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}

@@ -65,22 +65,17 @@
 istence.
-Entity
+*
 ;%0Aimport
@@ -83,27 +83,48 @@
 java
-x.persistence.Table
+.util.Collections;%0Aimport java.util.List
 ;%0A%0A@
@@ -198,137 +198,721 @@
 y %7B%0A
-%09%0A%09private String name;%0A%0A%09public String getName() %7B%0A%09%09return name;%0A%09%7D%0A%0A%09public void setName(String name) %7B%0A%09%09this.name = name;%0A%09%7D%0A
+%0A%09@Column(nullable = false)%0A%09private String name;%0A%0A%09@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = %22domain%22)%0A%09private List%3CAccount%3E accounts = Collections.emptyList();%0A%0A%09@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = %22domain%22)%0A%09private List%3CAlias%3E aliases = Collections.emptyList();%0A%0A%09public String getName() %7B%0A%09%09return name;%0A%09%7D%0A%0A%09public void setName(String name) %7B%0A%09%09this.name = name;%0A%09%7D%0A%0A%09public List%3CAccount%3E getAccounts() %7B%0A%09%09return accounts;%0A%09%7D%0A%0A%09public void setAccounts(List%3CAccount%3E accounts) %7B%0A%09%09this.accounts = accounts;%0A%09%7D%0A%0A%09public List%3CAlias%3E getAliases() %7B%0A%09%09return aliases;%0A%09%7D%0A%0A%09public void setAliases(List%3CAlias%3E aliases) %7B%0A%09%09this.aliases = aliases;%0A%09%7D
 %0A%7D%0A

Make domain - alias/account mapping bidirectional cascade remove operations