Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sofuni.exam.models.entity;
- import jakarta.persistence.*;
- import lombok.Getter;
- import lombok.Setter;
- import sofuni.exam.models.enums.Type;
- import java.util.List;
- import java.util.Set;
- @Getter
- @Setter
- @Entity
- @Table(name = "planets")
- public class Planet extends BaseEntity {
- @Column(nullable = false, unique = true)
- private String name;
- @Column(nullable = false)
- private int diameter;
- @Column(name = "distance_from_sun",nullable = false)
- private Long distanceFromSun;
- @Column(name = "orbital_period", nullable = false)
- private Double orbitalPeriod;
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private Type type;
- @OneToMany(mappedBy = "planet")
- private List<Moon> moons;
- }
- =============================================
- package sofuni.exam.models.entity;
- import jakarta.persistence.*;
- import lombok.Getter;
- import lombok.Setter;
- import java.util.List;
- @Getter
- @Setter
- @Entity
- @Table(name = "discoverers")
- public class Discoverer extends BaseEntity {
- @Column(name = "first_name", nullable = false)
- private String firstName;
- @Column(name = "last_name",nullable = false)
- private String lastName;
- @Column(nullable = false)
- private String nationality;
- @Column
- private String occupation;
- @OneToMany(mappedBy = "discoverer")
- private List<Moon> moons;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement