I have thought extensively about it and came up with these 2 classes:
public class Drone {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@NotEmpty(message = "Serial Number is required")
@Size(max = 100)
private String serial_number;
private ModelType model;
@Max(500)
private int weight_limit;
@NotEmpty(message = "Battery capacity is required")
private BigDecimal battery_capacity;
private StateType state;
}
and
public class Medication {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Pattern(regexp = "^[a-zA-Z0-9_-]*$")
private String name;
private float weight;
@Pattern(regexp = "^[a-zA-Z0-9_]*$")
private String code;
@Column(nullable = true, length = 64)
private String image;
}
But I just can't figure out how to link them since each drone will be carrying medications. I still think I'm missing something. Any ideas?