-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptionFundingEntity.java
More file actions
50 lines (41 loc) · 1.28 KB
/
OptionFundingEntity.java
File metadata and controls
50 lines (41 loc) · 1.28 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
48
49
50
package NextLevel.demo.funding.entity;
import NextLevel.demo.BasedEntity;
import NextLevel.demo.option.OptionEntity;
import NextLevel.demo.user.entity.UserEntity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "option_funding")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
public class OptionFundingEntity extends BasedEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(targetEntity = OptionEntity.class, fetch = FetchType.EAGER)
@JoinColumn(name = "option_id")
private OptionEntity option;
@ManyToOne(targetEntity = UserEntity.class, fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private UserEntity user;
@OneToOne(mappedBy = "optionFunding", targetEntity = CouponEntity.class, fetch = FetchType.LAZY)
private CouponEntity coupon;
@Column
private long count;
public void updateCount(long count) {
this.count += count;
}
@Override
public String toString() {
return "FundingEntity{" +
"id=" + id +
", count=" + count +
'}';
}
}