P E N C I L
Login
Association
  1. Best explanation
    1. https://www.thoughts-on-java.org/ultimate-guide-association-mappings-jpa-hibernate/
  2. At database schema lelve, there are 1-1, 1-many, many-many table relation ships.
    They are mapped to asoosciation between object, which can be unidirectional or bidirectional.
  3. 1-Many
    1. Unidirectional Many-one
      class OrderItem {
         @ManyToOne
          @JoinColumn(name=''fk_order)
          Order order;
      }
    2. Unidrectional One-Many
      class Order {
          @OneToMany 
           @JoinColumn(name="fk_order")
           Set<Item> items;
      }
    3. Bidirectional
      class Item { @ManyToOne @JoinColumn("fk_order) Order order}
      class Order { @OneToMany(mappedBy="order")} Set<Item> items; }
  4. Many-Many
    At DB level: an association table
    1. Bidirectional
      @ManyToMany @JoinTable(joinColumn, inversedJoinColumn
      @ManyToMany(mappedBy="products")