一个hibernate 4.1.2的bug

Example 2: One-to-one association that assumes both the source and target share the same primary key values. 

    // On Employee class:

    @Entity
    public class Employee {
        @Id Integer id;
    
        @OneToOne @MapsId
        EmployeeInfo info;
        ...
    }

    // On EmployeeInfo class:

    @Entity
    public class EmployeeInfo {
        @Id Integer id;
        ...
    }

以上这种以共享主键的方式实现OneToOne,在hibernate 4.1.2中创建表时:

create table tmp_bodys (heart_id varchar2(255 char) not null, primary key (heart_id), unique (heart_id))

ORA-02261: such unique or primary key already exists in the table

这个问题在

至少在hibernate 4.1.8 Final 中已经修正了。

create table tmp_bodys (heart_id varchar2(255 char) not null, primary key (heart_id))

你可能感兴趣的:(一个hibernate 4.1.2的bug)