package io.crowdcode.flaschenlager.product.model;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;

@Entity
@Getter
@Setter
@Accessors(chain = true)
public class Product {

    @Id
    @GeneratedValue
    private Long id;

    @Version
    private Long version;

    @NotNull
    private String name;

    @NotNull
    private String description;

    @NotNull
    private String unit;

    @NotNull
    private Double amount;

}

@@ -153,21 +153,101 @@
 stence.E
-ntity
+lementCollection;%0Aimport javax.persistence.Entity;%0Aimport javax.persistence.FetchType
 ;%0Aimport
@@ -388,16 +388,92 @@
 NotNull;
+%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;
 %0A%0A@Entit
@@ -794,10 +794,808 @@
 mount;%0A%0A
+    @ElementCollection(fetch = FetchType.EAGER)%0A    private List%3CString%3E tags = new ArrayList%3C%3E();%0A%0A    public Product addTags(String... tags) %7B%0A        this.tags.addAll(Arrays.asList(tags));%0A        return this;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        if (this == o) return true;%0A        if (o == null %7C%7C getClass() != o.getClass()) return false;%0A%0A        Product product = (Product) o;%0A%0A        if (id != null ? !id.equals(product.id) : product.id != null) return false;%0A        return version != null ? version.equals(product.version) : product.version == null;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        int result = id != null ? id.hashCode() : 0;%0A        result = 31 * result + (version != null ? version.hashCode() : 0);%0A        return result;%0A    %7D%0A
 %7D%0A

add product tags