From: Roland Häder Date: Sun, 23 Jul 2017 16:53:05 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4825bcc9ccb1e32b860ce70fc52e779936738701;p=jcontacts-business-core.git Continued a bit: - 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 --- diff --git a/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java index a1fde41..7282d1f 100644 --- a/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java @@ -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