• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

one object multiple tables

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem: Two tables One class
can anyone help me map Order with hibernate ??

I have One pojo Orders with following properties
userId comes from object User
and Map includes Item name and quantity of Item in basket

Order


Item


User

my tables summary is below
Order ID is primary key in UserOrder and foreign key in Orders
in orders Order ID and and Item ID are composite Primary key

Tables

UserOrder
---------


ORDERS
-------


 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi and welcome to the JavaRanch!

Why do you have 2 identifiers instead of references in the Order class?
 
Aahil Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
itemId is a reference to itemId of the Object Item
which identifiers you are talking about ?


Wouter Oet wrote:Hi and welcome to the JavaRanch!

Why do you have 2 identifiers instead of references in the Order class?


 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I was mistaken. Only one identifier. I mean why this:And not this:

reply
    Bookmark Topic Watch Topic
  • New Topic