我想将 @QueryHint(name=QueryHints.BATCH, value="pi.jrnls") 注释与主键 @Id 查找一起使用。我在哪里放置注释?看起来我只能将它放在@NamedQuery 中。但是默认的 pk 查找当然没有 @NamedQuery。
@Entity
@Table(schema="prd", name="PRDITEM", uniqueConstraints= {@UniqueConstraint(columnNames= {"prditmNO"})})
@Cache(expiry=com.quoka.qis.lib.persistence.Constants.SHORT_CACHE_PERIODE_MS)
@NamedQuery(name = "PrdItem.findByNo", query = "select pi from PrdItem pi where pi.no = ?1",
hints={
@QueryHint(name=QueryHints.BATCH, value="pi.jrnls"),
@QueryHint(name=QueryHints.BATCH, value="pi.bookings")//,
}
)
public class PrdItem {....
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="prditmID", insertable = false, nullable=false, unique=true)
private Long id;