Declare Money as Embeddable
This commit is contained in:
parent
ec7887f0d0
commit
34124c2182
@ -2,8 +2,7 @@ package dst.ass1.jpa.model.impl;
|
|||||||
|
|
||||||
import dst.ass1.jpa.model.*;
|
import dst.ass1.jpa.model.*;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Id;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@ -11,6 +10,7 @@ public class Match implements IMatch {
|
|||||||
@Id
|
@Id
|
||||||
private Long id;
|
private Long id;
|
||||||
private Date date;
|
private Date date;
|
||||||
|
@Embedded
|
||||||
private IMoney fare;
|
private IMoney fare;
|
||||||
|
|
||||||
// TODO add annotations
|
// TODO add annotations
|
||||||
|
|||||||
@ -2,8 +2,10 @@ package dst.ass1.jpa.model.impl;
|
|||||||
|
|
||||||
import dst.ass1.jpa.model.IMoney;
|
import dst.ass1.jpa.model.IMoney;
|
||||||
|
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
public class Money implements IMoney {
|
public class Money implements IMoney {
|
||||||
private String currency;
|
private String currency;
|
||||||
private BigDecimal value;
|
private BigDecimal value;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import dst.ass1.jpa.model.IMoney;
|
|||||||
import dst.ass1.jpa.model.ITrip;
|
import dst.ass1.jpa.model.ITrip;
|
||||||
import dst.ass1.jpa.model.ITripInfo;
|
import dst.ass1.jpa.model.ITripInfo;
|
||||||
|
|
||||||
|
import javax.persistence.Embedded;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
@ -15,6 +16,7 @@ public class TripInfo implements ITripInfo {
|
|||||||
private Long id;
|
private Long id;
|
||||||
private Date completed;
|
private Date completed;
|
||||||
private Double distance;
|
private Double distance;
|
||||||
|
@Embedded
|
||||||
private IMoney total;
|
private IMoney total;
|
||||||
private Integer driverRating;
|
private Integer driverRating;
|
||||||
private Integer riderRating;
|
private Integer riderRating;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user