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...
我在这里的表现思考,但如果没有解决方案,可能我会用你的建议。 –