From: Roland Haeder <roland@mxchange.org>
Date: Sun, 6 Mar 2016 18:26:07 +0000 (+0100)
Subject: Unique constrains are required as 2 users should NOT use 1 cellphone number
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c21778b45b9797043fc75fe679fae54ba9ed5a67;p=jcontacts-core.git

Unique constrains are required as 2 users should NOT use 1 cellphone number
---

diff --git a/src/org/mxchange/jcontacts/contact/UserContact.java b/src/org/mxchange/jcontacts/contact/UserContact.java
index 2a1c568..ede2cf4 100644
--- a/src/org/mxchange/jcontacts/contact/UserContact.java
+++ b/src/org/mxchange/jcontacts/contact/UserContact.java
@@ -85,7 +85,7 @@ public class UserContact implements Contact, Comparable<Contact> {
 	/**
 	 * Cellphone number
 	 */
-	@JoinColumn (name = "contact_cellphone_number_id", referencedColumnName = "cellphone_id")
+	@JoinColumn (name = "contact_cellphone_number_id", referencedColumnName = "cellphone_id", unique = true)
 	@OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL)
 	private DialableCellphoneNumber contactCellphoneNumber;
 
@@ -135,7 +135,7 @@ public class UserContact implements Contact, Comparable<Contact> {
 	/**
 	 * Fax number
 	 */
-	@JoinColumn (name = "contact_fax_number_id", referencedColumnName = "fax_id")
+	@JoinColumn (name = "contact_fax_number_id", referencedColumnName = "fax_id", unique = true)
 	@OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
 	private DialableFaxNumber contactFaxNumber;
 
@@ -179,7 +179,7 @@ public class UserContact implements Contact, Comparable<Contact> {
 	/**
 	 * Phone number
 	 */
-	@JoinColumn (name = "contact_phone_number_id", referencedColumnName = "phone_id")
+	@JoinColumn (name = "contact_phone_number_id", referencedColumnName = "phone_id", unique = true)
 	@OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
 	private DialableLandLineNumber contactPhoneNumber;