Rohit Prabhakar

I build agentic revenue systems for Fortune 50 companies

  • Digital Transformation
  • Leadership
  • Marketing
  • Writing
  • Home
  • Privacy Policy
Rohit Prabhakar
  • About
  • Market-of-One
  • ARCĀ
  • Speaking
  • Blog
Subscribe
  • About
  • Market-of-One
  • ARCĀ
  • Speaking
  • Blog
  • Subscribe to the newsletter
All Blogs
Technology · April 19, 2007 · 2 min read

Mapping a class several times

Rohit Prabhakar
Rohit Prabhakar
CMO · CDO · Transformation Leader

Mapping a class several times

Imagine that you have several tables with some columns in common. For example, you could have ITEM_AUCTION and ITEM_SALE tables. Usually you map each table to an entity persistent class, ItemAuction and ItemSale respectively. With the help of entity names, you can save work and implement a single persistent class.
To map both tables to a single persistent class, use different entity names (and usually different property mappings):

…

entity-name=”ItemSale” table=”ITEM_SALE”>
…

The model.Item persistent class has all the properties you mapped: id, description, initialPrice, and salesPrice. Depending on the entity name you use at runtime, some properties are considered persistent and others transient:
Item itemForAuction = new Item();
itemForAuction.setDescription(“An item for auction”);
itemForAuction.setInitialPrice( new BigDecimal(99) );
session.save(“ItemAuction”, itemForAuction);
Item itemForSale = new Item();
itemForSale.setDescription(“An item for sale”);

Domain models and metadata
itemForSale.setSalesPrice( new BigDecimal(123) );
session.save(“ItemSale”, itemForSale);

Thanks to the logical entity name, Hibernate knows into which table it should insert the data. Depending on the entity name you use for loading and querying entities, Hibernate selects from the appropriate table.

Rohit Prabhakar
www.rohitprabhakar.com

content from http://prabhakars.blogspot.com/atom.xml

Technology #Chandigarh#Hibernate#mapping#multiple tables#Rohit Prabhakar
Share LinkedIn Twitter
Related post on Technology
What is Bard by Google? How is it different from ChatGPT
Feb 6, 2023
Top Strategic Technology Trends – For CIOs | Not From Gartner
Jan 17, 2023
How To Remove Personal Information From Internet
Nov 16, 2022
All you need to know about Web 3.0 – benefits, technologies and future
Nov 10, 2022
What Is Metaverse — And Why It Is Seen As The Biggest Tech Trend Of 2022!
Sep 12, 2022
Artificial Intelligence’s Future Scope in Various Industries in 2022!
Jul 27, 2022
Newsletter
The Growth Architecture
Subscribe →
Rohit Prabhakar
Written by
Rohit Prabhakar

Fortune 50 CMO, board advisor, and operator. Writing on AI, growth architecture, and the Market of One -- the shift from segments to individuals.

More about Rohit →
← Previous Java Tiger (Java 5) is a history Next → Everest Indian Restaurant (5/5) Petaluma CA 94954
The Growth Architecture

Get the thinking before it's an article.

Weekly intelligence for executives building commercial organizations for the AI era. AI · Marketing · Sales · CX · Revenue.

Weekly · No spam · Unsubscribe anytime
Keep Reading

More from Rohit

The Frontier
The AI Power Era: The Week AI’s Center of Gravity Moved From Capability to Power
Jun 2026
The Frontier
The AI Trillion Era: The Week Capital, Cost, and Liability Caught Up to AI
Jun 2026
The Frontier
AI Weekly Memo – AI Sovereignty Era
Jun 2026
Rohit Prabhakar.

CMO · CDO · Transformation Leader.
Building growth engines where commercial instinct meets AI.

Ideas
  • Market-of-One
  • ARCĀ Framework
  • Blog
  • The Growth Architecture
Work With Rohit
  • Speaking
  • Advisory
  • Media & Press
  • Contact
Connect
  • LinkedIn
  • Twitter / X
  • Newsletter Archive
© 2026 Rohit Prabhakar · Market-of-One™ · ARCĀ Framework™
Privacy Policy Terms of Use

Copyright © 2026 · Genesis Framework · WordPress · Log in