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

  • Home
  • SEARCH
  • 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 410005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:50:46+00:00 2026-05-12T17:50:46+00:00

The system I’m working on has a domain object named Order which inherits from

  • 0

The system I’m working on has a domain object named Order which inherits from AbstractPersistentObject. Now I need to add another domain object named ExternalOrder which has some of the properties of Order but not all. I would like these two objects to be treated polimorphically in certain places. Hence I’m thinking of implementing inheritance mapping.

I’ve created an AbstractOrder which now extends AbstractPersistentObject and moved the common properties to AbstractOrder. Order and ExternalOrder now extends AbstractOrder.

Since the Order table already has lots of data in the database, I would prefer not to make too many changes to the schema.

  1. If I omit InheritanceType.SINGLE_TABLE, which inheritance strategy would be better for me? I should mention I’ve to use OnetoMany join in at least one domain Object. The domain object would refer to AbstractOrder and Hibernate would decide at runtime the concrete subclass for this AbstractOrder.

  2. AbstractPersistentObject has @Id and @GeneratedValue(strategy=GenerationType.IDENTITY) for the property id. Is there a way to override this when I implement inheritance? As I understand, GenerationType.IDENTITY is not going to work for certain inheritance choices and I’m not sure how to override this. I’ve looked into @AttributeOverride but I think it’s only useful when you want to override certain @Column values.

  • 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-05-12T17:50:46+00:00Added an answer on May 12, 2026 at 5:50 pm

    1) You don’t really have too many options here. Two other inheritance mapping strategies are table per class which won’t work for you (as it doesn’t support IDENTITY) and joined subclasses which will require you to split your “Orders” table into two (AbstractOrder and Order) plus add another table for ExternalOrder.

    2) You can’t override attributes on id within inheritance hierarchy. That’s just as well, though, table-per-class strategy is definitely not ideal.

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

Sidebar

Related Questions

The system I am currently working on requires some role-based security, which is well
System.IO.Directory.GetFiles() returns a string[] . What is the default sort order for the returned
The System.Windows.Threading.DispatcherObject class (which DependencyObject is based on) contains a useful function, called CheckAccess()
Using System.Move() to insert/delete item(s) from an array of string is not as easy
The System.Reactive.dll adds a class AsyncLock to System.Concurrency. It has a single instance method,
Our system communicates with several web services providers. They are all invoked from a
the system I'm working with consists of: A front-end application written in most likely
System.IO.BinaryReader reads values in a little-endian format. I have a C# application connecting to
System.Drawing.Color objects apparently won't serialize with XmlSerializer. What is the best way to xml
Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?

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.