RohanAditeya / fantasy-football-model

0 stars 0 forks source link

Fix primary key for the entity class LeagueTeam #1

Open RohanAditeya opened 8 months ago

RohanAditeya commented 8 months ago

The league team table has the entity class as defined in the SQL script here sql CREATE TABLE IF NOT EXISTS LEAGUE_TEAM ( CODE INT NOT NULL UNIQUE, DRAW INT, FORM DECIMAL(5, 2), LOSS INT, NAME VARCHAR(30) NOT NULL, PLAYED INT, POINTS INT, POSITION INT, SHRT_NAME VARCHAR(3), STRGTH INT, TEAM_DIV VARCHAR(10), UN_AVLBL BOOLEAN, WIN INT, STRGTH_OVR_HOME INT, STRGTH_OVR_AWAY INT, STRGTH_ATT_HOME INT, STRGTH_ATT_AWAY INT, STRGTH_DEF_HOME INT, STRGTH_DEF_AWAY INT, PULSE_ID INT, CONSTRAINT LEAGUE_TEAM_PRIMARY PRIMARY KEY (CODE,NAME) ); However the model entity class LeagueTeam is only having the @Id on the field code since if the @Id is used on an @Embedded JPA class then it is causing issues when referencing the code column as a foreign key from other tables using JPA specification. Need to find the proper way to represent the tables using the JPA specifications.