Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.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
Hibernate嵌入式层次结构_Hibernate - Fatal编程技术网

Hibernate嵌入式层次结构

Hibernate嵌入式层次结构,hibernate,Hibernate,我想在我的实体中嵌入一个对象。即,我希望该类型与MyEntity位于同一表格中 @Entity public class MyEntity<T extends MyType> { @Id long id; @Any(metaColumn = @Column(name = "MY_TYP")) @AnyMetaDef( idType = "integer", metaType = "string", me

我想在我的实体中嵌入一个对象。即,我希望该类型与MyEntity位于同一表格中

@Entity
public class MyEntity<T extends MyType> {
    @Id
    long id;

    @Any(metaColumn = @Column(name = "MY_TYP"))
    @AnyMetaDef(
        idType = "integer",
        metaType = "string",
        metaValues = {
                @MetaValue(value = "ConcreteType", targetEntity = ConcreteType.class)
        })
    @JoinColumn(name = "MY_ENTITY_ID")
    T typ;
和一个具体的类型

 @Embeddable
 @Access(AccessType.FIELD)
 public class ConcreteType implements MyType {
     long myField;
 }
两个对象应保存在同一个表中

表:MY_实体

列:ID、我的\类型、我的\字段

有没有办法做到这一点

public interface MyType {
}
 @Embeddable
 @Access(AccessType.FIELD)
 public class ConcreteType implements MyType {
     long myField;
 }