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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:11:24+00:00 2026-05-26T05:11:24+00:00

Actually the Question is in the title. The entities will be map Comments for

  • 0

Actually the Question is in the title.

The entities will be map Comments for different objects in system(Blog nodes, comments, etc.)
so I want to be able work with this column(read it’s value for building comment tree for particular type of Commented object type.
Also I want to add @DiscriminatorColumn in the equals and hashcode methods.
What is the best way to do this?

  • 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-26T05:11:25+00:00Added an answer on May 26, 2026 at 5:11 am

    This problem comes as whenever you load the entity, the discriminator value is always null. So if you try to add the discriminator value in equals you might get null pointer, So to do so there are two ways:-

    1. One is whenever you use discriminator, you have certain sub classes, then on the basis of sub classes you can equate two objects.
    2. You can add a sort of temporary variable in your entity, and then while mapping you can insert="false" update="false" on to that attribute, which will make your attribute read only, and then for that attribute you can put the equals.

    eg:-

    private String tempDiscriminatorValue;
    <property name="tempDiscriminatorValue" type="string" column="DISCR_VAL" insert="false" update="false"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually the title of the question is not properly right, what I want in
Actually my question is all in the title. Anyway: I have a class and
There are actually 2 question i want to cover in this topic. 1) Is
EDIT: Original Title: Question about the benefit of using an ORM. I want to
Actually the question is simple. I don't know what to add to the title
The question is in the title, actually - let's say I have a simple
The question is pretty simple actually. I have a module in my system containing
Kind of a long title, but that is generally the question. I want to
Entire question (actually, almost two) fit into the title line, so i dont see
Sorry about the vague question title, I just want to ascertain some things. Static

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.