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

one object multiple tables

 
Aahil Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
-------


 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • 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
  • 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
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I was mistaken. Only one identifier. I mean why this:And not this:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic