-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransaction.java
More file actions
47 lines (38 loc) · 1.03 KB
/
Transaction.java
File metadata and controls
47 lines (38 loc) · 1.03 KB
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
import java.sql.Timestamp;
public class Transaction {
private int txnId;
private int accountId;
private String type;
private double amount;
private Timestamp txnTime;
// constructor for INSERT (txnId, txnTime auto-handled by DB)
public Transaction(int accountId, String type, double amount) {
this.accountId = accountId;
this.type = type;
this.amount = amount;
}
// constructor for FETCH (when reading from DB)
public Transaction(int txnId, int accountId, String type, double amount, Timestamp txnTime) {
this.txnId = txnId;
this.accountId = accountId;
this.type = type;
this.amount = amount;
this.txnTime = txnTime;
}
// getters
public int getTxnId() {
return txnId;
}
public int getAccountId() {
return accountId;
}
public String getType() {
return type;
}
public double getAmount() {
return amount;
}
public Timestamp getTxnTime() {
return txnTime;
}
}