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