Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:47:00+00:00 2026-06-16T01:47:00+00:00

I am new to Hibernate and ORM in general. I’ve got a Product entity

  • 0

I am new to Hibernate and ORM in general.

I’ve got a Product entity which holds properties such as description, price, barcode and other product generics.

Now I want to manage other product specific data, e.g. I can imagine a Sunglasses entity with information about lenses, size …. and a Watch entity with other details related to shape, battery duration and so on.

Which is the better strategy? In a “non-ORM” world I would have had:

  • two tables: watches and sunglasses, with duplicated fields

  • one table: “products” with ALL properties from watches and glasses and a field “kindOfProduct”

How can I model that on Hibernate/JPA?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:47:01+00:00Added an answer on June 16, 2026 at 1:47 am

    You mainly have three inheritance strategies to choose from. The two you mentioned in the question, plus a mixed one, which stores the common attributes into a base table, and the specific properties into specialized tables.

    But with only this information, it’s a bit hard to give an advice, as there are rules and constraints on what you can accomplish with each of the strategies. I’d suggest to start by reading the Hibernate documentation on this topic and experimenting by yourself:

    http://docs.jboss.org/hibernate/stable/orm/manual/en-US/html_single/#d0e7071

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm quite new to hibernate and have stumbled on this problem, which I can't
I'm new to PHP and also with Doctrine. (Worked before with Hibernate ORM implementation).
I'm new to Hibernate ORM and I think you can help me understand it
I am trying to follow this Hibernate tutorial: http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/tutorial.html which seems pretty easy &
I am new to Fluent NHibernate and ORM tools in general. I'm not exactly
When I persist new created entity by JPA-Hibernate, some setter methods are called. Why?
i am new to spring/hibernate and was trying out my first app. I got
I'm new to NHibernate and FNH as well. I'm familiar with ORM's and decided
at first i'm really new to ORM, nhibernate and FHN. i look into this
Hi i am new to hibernate technology and i have few issues. Suppose if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.