我尝试从我的 MySQL 数据库创建一个实体类。Netbeans 中的向导给我错误消息“无法添加,因为它没有主键”。但是我的表中有一个主键。这似乎是其他人在这个论坛遇到的一个错误:
https://netbeans.org/bugzilla/show_bug.cgi?id=167389
我已经尝试了线程中的建议,但没有得到它的工作。我错过了什么?我可以强制 Netbeans 导入实体类吗?
我正在使用 NetBeans 7.3
这是我的桌子:
CREATE TABLE IF NOT EXISTS `estelle`.`FrasVal` (
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
`Varde` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL ,
`Kommentar` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL ,
`RegistreratDatum` DATETIME NOT NULL ,
`FrasFragaSvarAlternativ_ID` INT(11) NULL ,
`Anvandare_ID` INT(11) NOT NULL ,
`Patient_ID` INT(11) NOT NULL ,
`FrasFraga_ID` INT(11) NOT NULL ,
PRIMARY KEY (`ID`) ,
UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) ,
INDEX `fk_FrasVal_FrasFragaSvarAlternativ1_idx` (`FrasFragaSvarAlternativ_ID` ASC) ,
INDEX `fk_FrasVal_Anvandare1_idx` (`Anvandare_ID` ASC) ,
INDEX `fk_FrasVal_Patient1_idx` (`Patient_ID` ASC) ,
INDEX `fk_FrasVal_FrasFraga1_idx` (`FrasFraga_ID` ASC) ,
CONSTRAINT `fk_FrasVal_FrasFragaSvarAlternativ1`
FOREIGN KEY (`FrasFragaSvarAlternativ_ID` )
REFERENCES `estelle`.`FrasFragaSvarAlternativ` (`ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_FrasVal_Anvandare1`
FOREIGN KEY (`Anvandare_ID` )
REFERENCES `estelle`.`Anvandare` (`ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_FrasVal_Patient1`
FOREIGN KEY (`Patient_ID` )
REFERENCES `estelle`.`Patient` (`ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_FrasVal_FrasFraga1`
FOREIGN KEY (`FrasFraga_ID` )
REFERENCES `estelle`.`FrasFraga` (`ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_unicode_ci;