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

Modelling a situation in spring mvc with jpa and hibernate

 
Ayan mallick
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation in modelling a system of online auction like there will be items which will be posted
for auction with their features and all. now there will be bidders bidding for it. Here ultimately when one bid will be accepted that bideer will be attached with that item. now i have an "item" table which stores all details about the item. so how to realise this one to one relationship in jpa annotation. because when item is being posted for auction then i don't know which bidder's bid will be accepted.
so how to use @one to one here using jpa.

or should i model the problem in different way like two table one for auction item posted and item bid accepted. because when bid accpted then i know the bidder details.so there i can use @one to one easily.please give some ideas.
 
Dave Tolls
Ranch Hand
Posts: 2110
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have thought it is One To Many, or can a Bidder not bid for multiple Items?

In any case, you could simply have a acceptedBidder field on Item that maps to the accepted Bidder.
If it's null then the Item is still up for grabs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic