]> git.mxchange.org Git - jbonuscard-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 21:40:13 +0000 (23:40 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 21:40:13 +0000 (23:40 +0200)
- added named queries for retrieving all, user's and receipt's receipt items

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java
src/org/mxchange/jfinancials/model/receipt/item/FinancialReceiptItem.java

index 5d4d72fb7addb31060b4eefabf28d0367c6ed0c9..37b78199621080b470712aac9ac179734c20a38a 100644 (file)
@@ -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;
 
 /**
  *
index c618991c3a070c08491e9e56105b668f174fb76c..df48d4372b674ca235f902e1044bcd858f98239d 100644 (file)
@@ -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 {