Set relationships
This commit is contained in:
parent
858cc196ad
commit
1f5943e871
@ -6,6 +6,7 @@ import dst.ass1.jpa.model.ITrip;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import java.util.Collection;
|
||||
|
||||
@Entity
|
||||
public class Location implements ILocation {
|
||||
@ -15,7 +16,7 @@ public class Location implements ILocation {
|
||||
private Long locationId;
|
||||
|
||||
@ManyToMany
|
||||
private ITrip trip;
|
||||
private Collection<ITrip> trips;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
|
||||
@ -13,9 +13,11 @@ public class Match implements IMatch {
|
||||
@Embedded
|
||||
private IMoney fare;
|
||||
|
||||
// TODO add annotations
|
||||
@OneToOne
|
||||
private ITrip trip;
|
||||
@ManyToOne
|
||||
private IVehicle vehicle;
|
||||
@ManyToOne
|
||||
private IDriver driver;
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,6 +15,8 @@ public class Organization implements IOrganization {
|
||||
private String name;
|
||||
@ManyToMany
|
||||
private Collection<IOrganization> parts;
|
||||
@ManyToMany(mappedBy = "parts")
|
||||
private Collection<IOrganization> partOf;
|
||||
|
||||
public Organization() {
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import dst.ass1.jpa.model.*;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
@ -17,6 +18,7 @@ public class Trip implements ITrip {
|
||||
private ILocation pickup;
|
||||
private ILocation destination;
|
||||
|
||||
@ManyToMany(mappedBy = "trip")
|
||||
private Collection<ILocation> stops;
|
||||
private ITripInfo tripInfo;
|
||||
private IMatch match;
|
||||
|
||||
@ -6,6 +6,7 @@ import dst.ass1.jpa.model.IOrganization;
|
||||
import dst.ass1.jpa.model.IVehicle;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Collection;
|
||||
|
||||
@Entity
|
||||
public class Vehicle implements IVehicle {
|
||||
@ -17,11 +18,11 @@ public class Vehicle implements IVehicle {
|
||||
private String type;
|
||||
|
||||
@OneToMany
|
||||
private IDriver driver;
|
||||
private Collection<IDriver> driver;
|
||||
@OneToMany
|
||||
private IMatch match;
|
||||
private Collection<IMatch> match;
|
||||
@ManyToMany
|
||||
private IOrganization organization;
|
||||
private Collection<IOrganization> organization;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user