2 * Copyright (C) 2016 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jshopcore.model.order.items;
19 import javax.persistence.Basic;
20 import javax.persistence.CascadeType;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.OneToOne;
28 import javax.persistence.Table;
29 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
30 import org.mxchange.jshopcore.model.basket.items.BaseItem;
31 import org.mxchange.jshopcore.model.product.GenericProduct;
32 import org.mxchange.jshopcore.model.product.Product;
35 * A general basket item
37 * @author Roland Haeder<roland@mxchange.org>
39 @Entity (name = "ordered_item")
40 @Table (name = "ordered_items")
41 public class OrderItem extends BaseItem implements AddableBasketItem, Comparable<AddableBasketItem> {
46 private static final long serialVersionUID = 44_189_562_738_723_581L;
51 @Basic (optional = false)
52 @Column (name = "order_amount", length = 20, nullable = false)
53 private Long orderedAmount;
56 * Entry id (from database backend)
59 @GeneratedValue (strategy = GenerationType.IDENTITY)
60 @Column (name = "order_id", nullable = false, length = 20)
66 @Basic (optional = false)
67 @Column (name = "order_item_type", length = 20)
68 private String itemType;
73 @JoinColumn (name = "order_product_id", updatable = false)
74 @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.MERGE)
75 private Product product;
84 public Long getItemId () {
89 public void setItemId (final Long itemId) {
94 public Product getItemProduct () {
99 public void setItemProduct (final Product product) {
100 this.product = product;
104 public String getItemType () {
105 return this.itemType;
109 public void setItemType (final String itemType) {
110 this.itemType = itemType;
114 public Long getOrderedAmount () {
115 return this.orderedAmount;
119 public void setOrderedAmount (final Long orderedAmount) {
120 this.orderedAmount = orderedAmount;