...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
............................. @EntityScan({"org.onap.policy.models.tosca.simple.concepts", "org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts"}) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Embeddable @Data public class ExampleKey implements Serializable { private static final long serialVersionUID = 1L; @Column(name = "name", length = 120) private String name; @Column(name = "version", length = 20) private String version; } @Entity @Table(name = "Example") @Data @EqualsAndHashCode public class JpaExample implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId @VerifyKey @NotNull private ExampleKey key; @Column private Boolean primed; @Column(name = "timeStamp", precision = 3) @Temporal(TemporalType.TIMESTAMP) @NotNull private Date timeStamp; } |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Entity @Table(name = "ExampleObjMap") @Data @EqualsAndHashCode public class JpaExampleObjMap implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId @VerifyKey @NotNull private ExampleKey key; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) @Lob private Map<@NotNull String, @NotNull JpaExample> examples; } |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
ExampleObjMap: name: ExampleObjMap version: 1.0.0 examples: MyKey1: name: example1 version: 1.0.0 MyKey2: name: example2 version: 1.0.0 |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Entity @Table(name = "ExampleObjMap") @Data @EqualsAndHashCode public class JpaExampleObjMap implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId @VerifyKey @NotNull private ExampleKey key; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinTable( joinColumns = {@JoinColumn(name = "parent_name", referencedColumnName = "name"), @JoinColumn(name = "parent_version", referencedColumnName = "version")}, inverseJoinColumns = {@JoinColumn(name = "child_name", referencedColumnName = "name"), @JoinColumn(name = "child_version", referencedColumnName = "version")}) private Map<@NotNull String, @NotNull JpaExample> examples; } |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Entity @Table(name = "ExampleObjMapEc") @Data @EqualsAndHashCode public class JpaExampleObjMapEc implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId @VerifyKey @NotNull private ExampleKey key; @ElementCollection @Lob private Map<@NotNull String, @NotNull JpaExample> examples; } |
...