Article:
  Hibernate Your Data
Subject:   Why fields "productId" and "orderId" in OrderItem?
Date:   2004-01-16 00:46:28
From:   anonymous2
Nice tutorial.


It's not clear to me why OrderItem has fields "productId" and "orderId". In fact I think that there are not needed as the class already has members "product" and "order".

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Why fields "productId" and "orderId" in OrderItem?
    2004-01-16 00:58:50  anonymous2 [View]

    Hi,

    Those fields are there just to make more clear what my intention was. Of course, you can replace them with product.getId() in OrderItem#getProductId() method, as shown in the example.

    Regards,
    Davor