]> git.mxchange.org Git - jcustomer-core.git/blob - src/org/mxchange/jshopcore/model/order/ShopOrder.java
JPA started
[jcustomer-core.git] / src / org / mxchange / jshopcore / model / order / ShopOrder.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.jshopcore.model.order;
18
19 import java.sql.Timestamp;
20 import javax.persistence.Basic;
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.Table;
27 import javax.persistence.Temporal;
28 import javax.persistence.TemporalType;
29
30 /**
31  * An entity class for shop orders
32  *
33  * @author Roland Haeder
34  */
35 @Entity (name = "Orders")
36 @Table (name = "orders")
37 public class ShopOrder implements Orderable {
38
39         /**
40          * Serial number
41          */
42         private static final long serialVersionUID = 19_728_938_459_834L;
43
44         /**
45          * Order id
46          */
47         @Id
48         @GeneratedValue (strategy = GenerationType.IDENTITY)
49         private Long id;
50
51         /**
52          * Customer id
53          */
54         @Basic (optional = false)
55         @Column (name = "customer_id", length = 20, nullable = false)
56         private Long customerId;
57
58         /**
59          * Access key
60          */
61         @Basic (optional = false)
62         @Column (name = "access_key", length = 100, nullable = false, unique = true)
63         private String accessKey;
64
65         /**
66          * Created timestamp
67          */
68         @Basic (optional = false)
69         @Temporal (TemporalType.TIMESTAMP)
70         @Column (nullable = false)
71         private Timestamp created;
72
73         @Override
74         public Timestamp getCreated () {
75                 return this.created;
76         }
77
78         @Override
79         public void setCreated (final Timestamp created) {
80                 this.created = created;
81         }
82
83         @Override
84         public Long getCustomerId () {
85                 return this.customerId;
86         }
87
88         @Override
89         public void setCustomerId (final Long customerId) {
90                 this.customerId = customerId;
91         }
92
93         @Override
94         public Long getId () {
95                 return this.id;
96         }
97
98         @Override
99         public void setId (final Long id) {
100                 this.id = id;
101         }
102 }