开发者

Java - Hibernate - Query - Association

开发者 https://www.devze.com 2022-12-17 11:03 出处:网络
I have three classes -> Metadata, MetadataValue and MetadataMetadataValue: Metadata private long id; privat开发者_运维知识库e Metadata parent;

I have three classes -> Metadata, MetadataValue and MetadataMetadataValue:

Metadata

private long id;
privat开发者_运维知识库e Metadata parent;
private long levelInTree;
private String code;
private String nameEn;
private String nameFr;
private String descriptionEn;
private String descriptionFr;
private String query;
private String metadataType;
private String dataType;
private String permittedAsNeighbour;
private String visibility;
private long timeToLive;
private Set<MetadataMetadataValue> metadataMetadataValueList = new HashSet<MetadataMetadataValue>();

MetadataValue

private long id;
private String valueEn;
private String valueFr;
private String code;
private String codeExample;
private Set<MetadataMetadataValue> metadataMetadataValueList = new HashSet<MetadataMetadataValue>();

MetadataMetadataValue

private long id;
private Metadata metadata;
private MetadataValue metadataValue;
private long valOrder;

Each class has an Hibernate mapping file.

The associations are:

"Metadata" one-to-many "MetadataMetadataValue" many-to-one "MetadataValue"

I must do a query to get all the "MetadataValue" objects which correspond to a "Metadata" object.

Thank you


select mv.metadataValue from MetadataMetadataValue mv where mv.metadata=:object
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号