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 114199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:49:23+00:00 2026-05-11T02:49:23+00:00

I have the following Hibernate Mapping, which has to be mapped using the Table

  • 0

I have the following Hibernate Mapping, which has to be mapped using the Table per Concrete Class Hierarchy:

<hibernate-mapping package='dao'>     <meta attribute='class-description'></meta>     <class name='PropertyDAO'>         <id name='id' column='id_property'>             <generator class='assigned'/>         </id>         <property name='address' column='address' type='string'/>         <union-subclass name='HouseDAO' table='house'>             <property name='noOfRooms' column='noOfRooms'/>             <property name='totalArea' column='totalArea'/>             <property name='price' column='price'/>         </union-subclass>         <union-subclass name='LandDAO' table='land'>             <property name='area' column='area'/>             <property name='unitPrice' column='unitPrice'/>         </union-subclass>     </class> </hibernate-mapping> 

Which means in the database i have only 2 tables :

  • house (id_property(PK), address, noOfRooms, totalArea, price)
  • land (id_property(PK), address, area, unitPrice)

As far as I understood, in this case the ids need to be generated explicitly before calling .save(), so my question is: How can I create a strategy for the automatically generation of the ids, so that the ids from the concrete class form a continuous domain when joined.

  • 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. 2026-05-11T02:49:23+00:00Added an answer on May 11, 2026 at 2:49 am

    The solution is to create another table that stores the next id; this value should be modified each time a user wants to insert a new entity. In this way, the domain is continuous

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

Sidebar

Related Questions

I have the following mapping: <hibernate-mapping package=server.modules.stats.data> <class name=User table=user> <id name=id> <generator class=native></generator>
Lets say I have the following mapping: <hibernate-mapping package=mypackage> <class name=User table=user> <id name=id
I have following setup A -> B -> C A-Mapping: <hibernate-mapping> <class name=db.base.A table=A>
I have dictionary which I'm mapping using Fluent NHibernate. The dictionary has a complex
Suppose that I have the following HBM mapping: <class name=Student table=student> <set name=classes table=student_classes
I have following mapping definitions: <class name=Role table=Role optimistic-lock=version > <id name=Id type=Int32 unsaved-value=0
I have the following classes which I would like to map using NHibernate class
I have following code using hibernate to throw a custom exception on error and
I have a product table that has a many-to-many relation to itself (using a
I have following kinds of classes for hibernate entity hierarchy. I am trying to

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.