Revision a18a4ca4
b/src/gr/ebs/gss/server/domain/AccountingInfo.java | ||
---|---|---|
27 | 27 |
import javax.persistence.Id; |
28 | 28 |
import javax.persistence.JoinColumn; |
29 | 29 |
import javax.persistence.ManyToOne; |
30 |
import javax.persistence.Table; |
|
30 | 31 |
import javax.persistence.Temporal; |
31 | 32 |
import javax.persistence.TemporalType; |
33 |
import javax.persistence.UniqueConstraint; |
|
34 |
import javax.persistence.Version; |
|
32 | 35 |
|
33 | 36 |
/** |
34 | 37 |
* This class holds information about bandwidth usage by users. |
35 | 38 |
* This information is broken down in time periods. |
36 | 39 |
*/ |
37 | 40 |
@Entity |
41 |
@Table(name="accountinginfo", uniqueConstraints=@UniqueConstraint(columnNames={"user_id", "dateFrom", "dateTo"})) |
|
38 | 42 |
public class AccountingInfo implements Serializable{ |
39 | 43 |
|
40 | 44 |
/** |
... | ... | |
46 | 50 |
private Long id; |
47 | 51 |
|
48 | 52 |
/** |
53 |
* Version field for optimistic locking. |
|
54 |
* XXX: the columnDefinition is postgres specific, if deployment database is changed this shall be changed too |
|
55 |
*/ |
|
56 |
@SuppressWarnings("unused") |
|
57 |
@Version |
|
58 |
@Column(columnDefinition=" integer DEFAULT 0") |
|
59 |
private int version; |
|
60 |
|
|
61 |
/** |
|
49 | 62 |
* The user whose usage we are noting. We can never change it after |
50 | 63 |
* creation. |
51 | 64 |
*/ |
52 | 65 |
@ManyToOne |
53 |
@JoinColumn(updatable = false, nullable = false) |
|
66 |
@JoinColumn(name="user_id", updatable = false, nullable = false)
|
|
54 | 67 |
private User user; |
55 | 68 |
|
56 | 69 |
/** |
... | ... | |
58 | 71 |
* creation. |
59 | 72 |
*/ |
60 | 73 |
@Temporal(TemporalType.TIMESTAMP) |
61 |
@Column(updatable = false, nullable = false) |
|
74 |
@Column(name="dateFrom", updatable = false, nullable = false)
|
|
62 | 75 |
private Date dateFrom; |
63 | 76 |
|
64 | 77 |
|
... | ... | |
67 | 80 |
* creation. |
68 | 81 |
*/ |
69 | 82 |
@Temporal(TemporalType.TIMESTAMP) |
70 |
@Column(updatable = false, nullable = false) |
|
83 |
@Column(name="dateTo", updatable = false, nullable = false)
|
|
71 | 84 |
private Date dateTo; |
72 | 85 |
|
73 | 86 |
|
Also available in: Unified diff