This week's book giveaway is in the Game Development forum.
We're giving away four copies of Badass: Making Users Awesome and have Kathy Sierra on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate 1 Class - 2 Tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate 1 Class - 2 Tables" Watch "Hibernate 1 Class - 2 Tables" New topic

Hibernate 1 Class - 2 Tables

Ally Cavs
Ranch Hand

Joined: Aug 25, 2008
Posts: 89
Hi Guys

I am using the hibernate xml mapping files to map object to a DB table. I have a invoice class along with its xml mapping file. The invoice class maps to invoice table

But now I need to map to a second table. the reason is for authorization. So users would create an invoice. But instead of been created on the invoice table. I want the information persisted to a pre authorised invoice table.
Then a manager reviews invoices, authorises upon which the invoice is copied over to the invoice table for further processing and removed from the pre authorised table.

The only solutions i see is using joins but this essentially maps different attributes of the invoice object to different tables. These 2 tables need to be identical. There are reasons to why i simply cant add an additional field called authorize. I need the 2 tables

I agree. Here's the link:
subject: Hibernate 1 Class - 2 Tables