0

我有两张桌子

        CREATE TABLE `cb_jobs` (
    `JOB_IDENTIFIER` INT(11) NOT NULL,
    `CB_CREDENTIAL_TYPE_IDENTIFIER` INT(11) NOT NULL
    `IS_DELETED` TINYINT(1) NULL DEFAULT '0',
    PRIMARY KEY (`JOB_IDENTIFIER`),
    INDEX `FK_cb_jobs_cb_credential_type` (`CB_CREDENTIAL_TYPE_IDENTIFIER`)
    CONSTRAINT `FK_cb_jobs_cb_credential_type` FOREIGN KEY (`CB_CREDENTIAL_TYPE_IDENTIFIER`) REFERENCES `cb_credential_type` (`CB_CREDENTIAL_TYPE_IDENTIFIER`) ON UPDATE CASCADE ON DELETECASCADE)COLLATE='latin1_swedish_ci'
    ENGINE=InnoDB;    
    CREATE TABLE `cb_credential_type` (
    `CB_CREDENTIAL_TYPE_IDENTIFIER` INT(11) NOT NULL AUTO_INCREMENT,
    `CB_CREDENTIAL_CODE` VARCHAR(50) NULL DEFAULT NULL,
    `CB_CREDENTIAL_TYPE_NAME` VARCHAR(1000) NULL DEFAULT NULL,
    `CREATED_DATE` DATETIME NULL DEFAULT NULL,
    `CREATED_BY_USER` INT(11) NULL DEFAULT NULL,
    `UPDATED_DATE` DATETIME NULL DEFAULT NULL,
    `UPDATED_BY_USER` INT(11) NULL DEFAULT NULL,
    `IS_DELETED` TINYINT(1) NULL DEFAULT '0',
    PRIMARY KEY (`CB_CREDENTIAL_TYPE_IDENTIFIER`)
    )COLLATE='latin1_swedish_ci'
    ENGINE=InnoDB
    AUTO_INCREMENT=8;    

我想根据凭证类型 id 获取第二张表的详细信息。如何使用休眠注释编写具有一对一关系的休眠映射类。任何人请帮助我.......

4

1 回答 1

0

查看本教程,这可能会对您有所帮助

http://www.dzone.com/tutorials/java/hibernate/hibernate-example/hibernate-mapping-one-to-one-1.html

查看hibernate一对一注释教程

http://www.dzone.com/tutorials/java/hibernate/hibernate-example/hibernate-mapping-one-to-one-using-annotations-1.html

于 2012-12-07T05:50:15.293 回答