Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Relationship between Bid and User

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In The book "Hibernate In Action"
In the code provided :
Bid.java


User.java


so this means that this is unidirectional relationship from Bid to User (many to one) as we are interested in [a particular bid is place by which user] and not in [a particular user places which all bids]..


Moreover In Item.java, in placeBid() method ...



The constructor of Bid is provided as :



Why Not in this constructor itself, we add item.addBid(this); ? so it will be more logical...



[ August 31, 2007: Message edited by: Sandeep Vaid ]
[ August 31, 2007: Message edited by: Sandeep Vaid ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure it really makes any difference. 6 of one half dozen of the other. Just as long at the object relationship that is wanted is done.

As far as which is more logical, I don't think either is more than the other, but that is just my opinion.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic