aspose file tools*
The moose likes Object Relational Mapping and the fly likes one object multiple tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "one object multiple tables" Watch "one object multiple tables" New topic
Author

one object multiple tables

Aahil Khan
Greenhorn

Joined: Jul 30, 2011
Posts: 2
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

Joined: Oct 25, 2008
Posts: 2700

Hi and welcome to the JavaRanch!

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


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Aahil Khan
Greenhorn

Joined: Jul 30, 2011
Posts: 2
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

Joined: Oct 25, 2008
Posts: 2700

Sorry I was mistaken. Only one identifier. I mean why this:And not this:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: one object multiple tables