• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Relationship between Bid and User

 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic