• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Before making an association

 
fu bace
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scenario is this. When user orders two product from different shops there has to
be two shipment for that order and two ShopOrder object is created for that Order.

class Order{
long id;
Set<ShopOrder> shopOrders;
}

class ShopOrder{
long id;
Order order,
Shipment shipment;
}

class Shipment{
long id;
Date shippedDate;
Date deliveredDate;
ShopOrder shopOrder;
}

When I want to list Orders that hasn't been finished yet
(If one of the shipment is not delivered that means order didnt finished yet)
What should the query will be
and if i crate a shipment attribute in Order class then what should the query will be?
(Think all associations bidirectional)

and last question. Should i make an association between Order and Shipment class. What is the criteria of making association?
I think that lack of association only makes writing queries much complex. Number of join queries increases etc. Am i right?




 
fu bace
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea? I'm really confused about this issue
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic