خرید بک لینک

Vote count: 0

I am having performance issues using hibernate. I have the following:

@Data
@Entity
@Table(name=""Order_product"")
public class OrderProduct {
    @Id
    @SequenceGenerator(name="Order_product_id_seq",
            sequenceName="Order_product_id_seq",
            allocationSize=1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE,
            generator="Order_product_id_seq")
    private long id;
    @ManyToOne
    @NotNull
    private Product product;
    @OneToOne
    @NotNull
    private ProductPrice price;
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @NotNull
    private Order order;
}

Now, whenever I am trying to execute:

List<OrderProduct> findByOrderId(@Param(value = "order") Long orderId);

Hibernate will load whole Order for each OrderProduct. How can I disable this, so that only ID of the Order will load?

asked 47 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 16 مهر 1395 ساعت: 8:24

صفحه بندی