Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么Hibernate为引用*到多个表的列创建序列? 大家好!_Java_Hibernate_Orm_Hibernate Mapping - Fatal编程技术网

Java 为什么Hibernate为引用*到多个表的列创建序列? 大家好!

Java 为什么Hibernate为引用*到多个表的列创建序列? 大家好!,java,hibernate,orm,hibernate-mapping,Java,Hibernate,Orm,Hibernate Mapping,我面临一个奇怪的问题。我正在尝试创建一个简单的数据库模式。但是hibernate为引用*中id列的列创建了额外的序列,以引用许多表 我用 @Id,@Column(columnDefinition=“serial”),@GeneratedValue(strategy=GenerationType.IDENTITY) 为BIGSERIAL类型创建序列(但我不希望hibernate将外键列设置为BIGSERIAL) 我的实体有这样的结构 @Entity public class Pro

我面临一个奇怪的问题。我正在尝试创建一个简单的数据库模式。但是hibernate为引用*中id列的列创建了额外的序列,以引用许多表

我用
@Id
@Column(columnDefinition=“serial”)
@GeneratedValue(strategy=GenerationType.IDENTITY)
BIGSERIAL
类型创建序列(但我不希望hibernate将外键列设置为
BIGSERIAL

我的实体有这样的结构

    @Entity
    public class PropertyItem {

        //id's here ...

        @ManyToOne(fetch = FetchType.LAZY)
        @JoinColumn(name = "property_id")
        private Property property;

        //getters and setters ...
    }

    @Entity
    public class Property {

        //id's here ...

        @OneToMany(mappedBy = "property")
        private List<PropertyItem> propertyItems;

        //getters and setters ...
    }
@实体
公共类属性项{
//身份证在这里。。。
@manytone(fetch=FetchType.LAZY)
@JoinColumn(name=“property\u id”)
私有财产;
//接球手和接球手。。。
}
@实体
公共类财产{
//身份证在这里。。。
@OneToMany(mappedBy=“财产”)
私有财产清单项目;
//接球手和接球手。。。
}
请帮我避免这种情况:(


谢谢你我明白了!

此注释
@Column(columnDefinition=“serial”)
是多余的