From: Roland Häder Date: Tue, 17 Oct 2017 21:40:13 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9f409a85c46158e975da4f1cba23ae3800ff5fcc;p=jbonuscard-core.git Continued: - added named queries for retrieving all, user's and receipt's receipt items Signed-off-by: Roland Häder --- 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 {