0
我有3個表:
發票(ID,userReadeableNum,...)
令(ID,userReadeableNum,...)
InvoiceOrderRel(ID,invoceId,訂單ID,insertDate,...)
JPA/Hibernate:可以將List屬性關聯到jpql查詢?
我想在Order類的userReadableNum的Invoice Class上創建一個List屬性。
事情是這樣的:
@Entity
@Table(name="INVOICE")
@Immutable
public class Invoice implements Serializable{
@Id
@Column(name="INV_ID")
private long invId;
//many attributes
/*I know that this annotation does not exists, i want to know if there's something similar*/
@ByQuery("select o.userReadableNum from Order o join o.invoiceOrderList iol where iol.order.invId = :invId")
private List<String> orderNums;
//etc...
我在這裏的表現思考,但如果沒有解決方案,可能我會用你的建議。 –