From 9f409a85c46158e975da4f1cba23ae3800ff5fcc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 17 Oct 2017 23:40:13 +0200 Subject: [PATCH] Continued: - added named queries for retrieving all, user's and receipt's receipt items MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../jfinancials/model/receipt/FinancialReceipt.java | 2 +- .../model/receipt/item/FinancialReceiptItem.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java index 5d4d72f..37b7819 100644 --- a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java @@ -39,10 +39,10 @@ import javax.persistence.Transient; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice; import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee; +import org.mxchange.jcontactsbusiness.model.employee.Employable; import org.mxchange.jproduct.model.payment.PaymentType; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.model.employee.Employable; /** * diff --git a/src/org/mxchange/jfinancials/model/receipt/item/FinancialReceiptItem.java b/src/org/mxchange/jfinancials/model/receipt/item/FinancialReceiptItem.java index c618991..df48d43 100644 --- a/src/org/mxchange/jfinancials/model/receipt/item/FinancialReceiptItem.java +++ b/src/org/mxchange/jfinancials/model/receipt/item/FinancialReceiptItem.java @@ -27,6 +27,8 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Index; import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; @@ -49,6 +51,13 @@ import org.mxchange.jproduct.model.product.Product; @Index (name = "item_receipt_product", columnList = "item_receipt_id,item_product_id", unique = true) } ) +@NamedQueries( + { + @NamedQuery(name = "AllReceiptItems", query = "SELECT ri FROM receipt_items AS ri ORDER BY ri.itemId ASC"), + @NamedQuery(name = "SearchAssignedReceiptItems", query = "SELECT ri FROM receipt_items AS ri WHERE ri.itemReceipt = :itemReceipt ORDER BY ri.itemId ASC"), + @NamedQuery(name = "SearchAllUserReceiptItems", query = "SELECT ri FROM receipt_items AS ri JOIN receipts AS r ON ri.itemReceipt=r WHERE r.receiptUser = :receiptUser ORDER BY ri.itemId ASC") + } +) @SuppressWarnings ("PersistenceUnitPresent") public class FinancialReceiptItem implements BillableReceiptItem { -- 2.39.5