0
我有三個班以下關係:HQL查詢與若干個連接
@Entity
public class User{
@OnetoMany
List<Attribute> attributes = new ArrayList<Attribute>();
}
@Entity
public class Attribute{
@ManyToOne
AttributeType attributeType;
}
@Entity
public class AttributeType{
@Column
String type;
}
一個用戶可以有n×m個類型的屬性。
我需要創建HQL查詢,它將返回特定用戶屬性的所有屬性類型List<AttributeType>
。
例如,用戶具有類型t的屬性a,類型t的屬性b和類型t1的屬性c。 我需要返回List<AttributeType>
,它將包含t和t1。
請幫忙。我只是迷失在這個查詢中。