From 4825bcc9ccb1e32b860ce70fc52e779936738701 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 23 Jul 2017 18:53:05 +0200 Subject: [PATCH] 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) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../jcontactsbusiness/CompanyBasicData.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 -- 2.39.5