My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.ctp.arquilliandemo.ex1.domain;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

/**
*
* @author Bartosz Majsak
*
*/
@Entity
public class TradeTransaction {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
private User user;

@NotNull
@ManyToOne
private Share share;

@NotNull
@Enumerated(EnumType.STRING)
private TransactionType type;

@Temporal(TemporalType.TIMESTAMP)
private Date timestamp = new Date();

@Basic
private Integer amount;

protected TradeTransaction() {
// required by JPA
}

public TradeTransaction(User user, Share share, Integer amount, TransactionType type) {
this.user = user;
this.share = share;
this.type = type;
this.amount = amount;
}

public Long getId() {
return id;
}

void setId(Long id) {
this.id = id;
}

public User getUser() {
return user;
}

public void setUser(User user) {
this.user = user;
}

public Share getShare() {
return share;
}

public void setShare(Share share) {
this.share = share;
}

public TransactionType getType() {
return type;
}

public void setType(TransactionType type) {
this.type = type;
}

public Date getTimestamp() {
return (Date) timestamp.clone();
}

void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}

public Integer getAmount() {
return amount;
}

public void setAmount(Integer amount) {
this.amount = amount;
}

}

Change log

r83 by bartosz.majsak on Jul 8, 2010   Diff
Example project for arquillian blog post -
initial version.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 2146 bytes, 106 lines
Powered by Google Project Hosting