The following classes:
@Data @Entity public class Num { @Id @GeneratedValue private Integer id; private Integer value; }
@Data @Entity public class Suma { @Id @GeneratedValue private Integer id; private String value; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn( name = "sum_id") private List<Num> nums; }Generate the following tables:
CREATE TABLE SUMA ( ID INTEGER NOT NULL, VALUE VARCHAR(255) ); CREATE UNIQUE INDEX SQL111206140004130 ON SUMA (ID ASC); ALTER TABLE SUMA ADD CONSTRAINT SQL111206140004130 PRIMARY KEY (ID);
CREATE TABLE NUM ( ID INTEGER NOT NULL, VALUE INTEGER, SUM_ID INTEGER ); CREATE INDEX SQL111206140004360 ON NUM (SUM_ID ASC); CREATE UNIQUE INDEX SQL111206140003900 ON NUM (ID ASC); ALTER TABLE NUM ADD CONSTRAINT SQL111206140003900 PRIMARY KEY (ID); ALTER TABLE NUM ADD CONSTRAINT FK_NUM_SUM_ID FOREIGN KEY (SUM_ID) REFERENCES SUMA (ID);
CREATE TABLE SEQUENCE ( SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15 , 0) ); CREATE UNIQUE INDEX SQL111206140004490 ON SEQUENCE (SEQ_NAME ASC); ALTER TABLE SEQUENCE ADD CONSTRAINT SQL111206140004490 PRIMARY KEY (SEQ_NAME);
No comments:
Post a Comment