]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Sun, 23 Jul 2017 16:53:05 +0000 (18:53 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 24 Jul 2017 22:08:36 +0000 (00:08 +0200)
- also headquarters are maybe optional (unknown to the user)
- added initial named query which loads all basic business data
- legal status may be empty for self-employed persons (single-person companies)

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/CompanyBasicData.java

index a1fde417962f0b1c8fbd9c221c8d6bd5c01b1932..7282d1fde700e160425bb5bddc078eed4b9e400e 100644 (file)
@@ -28,6 +28,8 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
@@ -54,6 +56,11 @@ import org.mxchange.jusercore.model.user.User;
  */
 @Entity (name = "company_basic_data")
 @Table (name = "company_basic_data")
+@NamedQueries (
+               {
+                       @NamedQuery (name = "AllBusinessData", query = "SELECT b FROM company_basic_data AS b ORDER BY b.businessDataId")
+               }
+)
 @SuppressWarnings ("PersistenceUnitPresent")
 public class CompanyBasicData implements BusinessBasicData {
 
@@ -114,8 +121,7 @@ public class CompanyBasicData implements BusinessBasicData {
        /**
         * Legal status of company (example: "Inc.", "GmbH")
         */
-       @Basic (optional = false)
-       @Column (name = "company_legal_status", nullable = false)
+       @Column (name = "company_legal_status")
        private String companyLegalStatus;
 
        /**
@@ -169,8 +175,8 @@ public class CompanyBasicData implements BusinessBasicData {
        /**
         * Reference to headquarters data
         */
-       @JoinColumn (name = "company_headquarters_data_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL, optional = false)
+       @JoinColumn (name = "company_headquarters_data_id")
+       @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL)
        private HeadQuartersData headQuartersData;
 
        @Override