2 * Copyright (C) 2015 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.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.GenerationType;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.OneToOne;
27 import javax.persistence.Table;
28 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
29 import org.mxchange.jshopcore.model.basket.items.BaseItem;
30 import org.mxchange.jshopcore.model.product.GenericProduct;
31 import org.mxchange.jshopcore.model.product.Product;
34 * A general basket item
36 * @author Roland Haeder<roland@mxchange.org>
38 @Entity (name = "ordered_item")
39 @Table (name = "ordered_items")
40 public class OrderItem extends BaseItem implements AddableBasketItem {
45 private static final long serialVersionUID = 44_189_562_738_723_581L;
50 @Basic (optional = false)
51 @Column (name = "amount", length = 20, nullable = false)
55 * Entry id (from database backend)
58 @GeneratedValue (strategy = GenerationType.IDENTITY)
59 @Column (name = "id", nullable = false, length = 20)
65 @Basic (optional = false)
66 @Column (name = "item_type", length = 20)
67 private String itemType;
72 @JoinColumn (name = "product_id", updatable = false)
73 @OneToOne (targetEntity = GenericProduct.class)
74 private Product product;
83 public Long getOrderedAmount () {
88 public void setOrderedAmount (final Long amount) {
93 public Long getItemId () {
98 public void setItemId (final Long id) {
103 public String getItemType () {
104 return this.itemType;
108 public void setItemType (final String itemType) {
109 this.itemType = itemType;
113 public Product getItemProduct () {
118 public void setItemProduct (final Product product) {
119 this.product = product;