2014-10-01 57 views

回答

3

这里的点表示属性路径表达式。

你应该阅读dataPointGroups.id.groupId为:

dataPointGroupsData类的属性(属性顾名思义一个从DataDataPointGroup实体一对多关系

DataPointGroup实体类进一步有id属性,可能是id属性是一个嵌入式主键(从属性id的名称判断,映射为@EmbeddedId

在任何情况下,该id属性的类别类型还具有名为groupId的属性。

希望我的解释清楚。

无论如何,这是实体和映射如何可能看起来像:

@Entity 
class Data { 
    @Id 
    long id;   

    @OneToMany 
    Set<DataPointGroup> dataPointGroups; 
} 

@Entity 
class DataPointGroup { 
    @EmbeddedId 
    DataPointGroupPkClass id; 
} 

@Embeddable 
class DataPointGroupPkClass { 
    long groupId; 
    long someOtherProperty; 
} 
相关问题