Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modification is needed for oneToOneLazy example in chapter 4

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, In the Employee.java, I think we need to add @JoinColumn to ParkingSpace:


Because the SQL commands are :

CREATE TABLE PARKING_SPACE (ID INTEGER  NOT NULL AUTO_INCREMENT,
                            LOT INTEGER, LOCATION VARCHAR(255), PRIMARY KEY (ID));
CREATE TABLE EMPLOYEE (ID INTEGER  NOT NULL AUTO_INCREMENT,
                       NAME VARCHAR(255), SALARY BIGINT,
                       PARKINGSPACE_ID INTEGER, PRIMARY KEY (ID),
                       CONSTRAINT PSPACE_FK FOREIGN KEY (PARKINGSPACE_ID) REFERENCES PARKING_SPACE(ID));

INSERT INTO PARKING_SPACE (LOT, LOCATION) VALUES (1, 'East Lot');
INSERT INTO PARKING_SPACE (LOT , LOCATION) VALUES (2, 'West Lot');

INSERT INTO EMPLOYEE (NAME, SALARY, PARKINGSPACE_ID) VALUES ('Joan', 59000, 1);
INSERT INTO EMPLOYEE (NAME, SALARY, PARKINGSPACE_ID) VALUES ('John', 59000, 1);

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic