]> git.mxchange.org Git - jcontacts-core.git/commitdiff
Unique constrains are required as 2 users should NOT use 1 cellphone number
authorRoland Haeder <roland@mxchange.org>
Sun, 6 Mar 2016 18:26:07 +0000 (19:26 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 6 Mar 2016 18:26:07 +0000 (19:26 +0100)
src/org/mxchange/jcontacts/contact/UserContact.java

index 2a1c568a677fcc310f0f6ee26215b75da13dc346..ede2cf46a4c81be2b87b269d43f2a2f8d866621f 100644 (file)
@@ -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;