• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on JustBuildIt Corp Class Diagram

 
suraj shikhar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm reading the worked out assignment in Chapter 9 of the Book - SCEA Study Guide by Cade and Sheil. I have a question on the class diagram.
The class diagram shows wood, steel and concrete as marked with @Entity. As per the problem statement, I thought the details of the inventory comes from an already existing inventory and order management system. The planned system would just consolidate the availability of these items and create bids.

I don't see any reason why we would be persisting the wood , steel and concrete to the proposed system.
My question is even if certain objects don't need to be persisted to the proposed system , but are part of the Domain model - do we need to mark them as @Entity?

Any response most be most welcome!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have made AvailabilityItem and entity and not those three. I can't think of a reason either.
 
Saket Mittal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If AvailabilityItem is an abstract class wouldn't we have to persist wood,steel, concrete to persist availability item ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saket Mittal wrote:If AvailabilityItem is an abstract class wouldn't we have to persist wood,steel, concrete to persist availability item ?

Not necessarily. Wood/steel/concrete could be a type column on the AvailabilityItem table.
 
Saket Mittal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry unable to understand. If AvailabilityItem is abstract then to persist information in the base class I will have to instantiate wood,steel,concrete and em.persist() them. And for this to work wood,steel,concrete have to be @Entity. Right ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saket Mittal wrote:Sorry unable to understand. If AvailabilityItem is abstract then to persist information in the base class I will have to instantiate wood,steel,concrete and em.persist() them. And for this to work wood,steel,concrete have to be @Entity. Right ?

If it is abstract, yes. I wouldn't have designed it as abstract was my point.
 
san kumar parihar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me share my views (along with my own doubts) with an example:

In case of wood, every single instance of it has a particular color, density and machineability. This is not like products which usually have predefined properties (think about soap, laptop, cars etc). In this example, characterstics classes are telling which attributes are important but who will store their actual values?

a) If Wood@Entity has to store these details, then is it modeled correctly?
b) If WoodCharacteristics stores it then why is not an @Entity class?

Please share your views because I am struggling with a similar problem.
 
Saket Mittal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
san kumar parihar wrote:Let me share my views (along with my own doubts) with an example:

In case of wood, every single instance of it has a particular color, density and machineability. This is not like products which usually have predefined properties (think about soap, laptop, cars etc). In this example, characterstics classes are telling which attributes are important but who will store their actual values?

a) If Wood@Entity has to store these details, then is it modeled correctly?
b) If WoodCharacteristics stores it then why is not an @Entity class?

Please share your views because I am struggling with a similar problem.


If characteristics needed to be persisted then WoodCharacteristics etc would have been shown as @Entity. I think the only properties being persisted are the ones present in AvailabilityItem. Wood,Steel,Concerete are shown as entities merely because AvailabilityItem is an Abstract class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic