BookTable
isbn VARCHAR(25) NOT NULL PRIMARY KEY,
bookTitle VARCHAR(150) NOT NULL,
publisher VARCHAR (200) NOT NULL,
copyRight BLOB(45) NOT NULL,
isBookAvailable TINYINT(0) NOT NULL
UNIQUE(isbn)
AuthorTable
authorId INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
firtName VARCHAR(200) NOT NULL,
lastName VARCHAR(200) NOT NULL
AuthorBooTable
authorIsbnId INT NOT NULL AUTO_INCREMENT,
isbn INT NOT NULL,
authorId INT NOT NULL,
PRIMARY KEY ( authorIsbnId ),
FOREIGN KEY (isbn) REFERENCES BookTable (isbn) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (authorId) REFERENCES AuthorTable (authorId) ON DELETE CASCADE ON UPDATE CASCADE
So far, I know how to get the authorId by using Statement.RETURN_GENERATED_KEYS
since the keys for the author table are generated automatically through "AUTO_INCREMENT". I need the both primary keys of the authorId from authorTable and isbn from the BookTable so that I can be able to create the relationship in the AuthorBookTable before saving the data to the database. My question, how can I get the isbn number from BookTable since it's a string and not "AUTO_INCREMENTED"? I have tried calling Statement.RETURN_GENERATED_KEYS
but doesn't return the primary key for the Book isbn primary key. Your help will be greatly appreciated thanks!