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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:12:56+00:00 2026-05-23T11:12:56+00:00

I am trying to relate two tables with spring / hibernate in MYSQL like

  • 0

I am trying to relate two tables with spring / hibernate in MYSQL like this

    @Table (name = candidatresumeinfo)
    public class CandidateResumeInfo implements Serializable
      {
     List<SelectedResumes> selectedResumes;
       .............
         ..............

     @JoinColumn(name = "selectedresumeid")
 @OneToMany
public List<SelectedResumes> getSelectedResumes() {
    return selectedResumes;
}
public void setSelectedResumes(List<SelectedResumes> selectedResumes) {
    this.selectedResumes = selectedResumes;
}

Now ,i got the data in my list correctly( i checked in debug)but the call from server is getting failed which is saying cause:Nullpointer exception .

thanks

  • 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-23T11:12:56+00:00Added an answer on May 23, 2026 at 11:12 am

    You can use OneToMany annotation only on Collections, so you should change the field to Set or List, because hibernate will return multiple result if you use OneToMany. I think you’d like to use ManyToOne annotation here.

    • ManyToOne means here that you have multiple CandidateResumeInfo for one SelectedResumes.
    • OneToMany means here that you have multiple SelectedResumes for one CandidateResumeInfo.

    This annotation naming can be a bit strange for first time. Hope I helped.

    Answer for your comment:

    The best way is you declare the relationship both side.
    Here is the example:

    CandidateResumeInfo.java:

    @OneToMany(mappedBy="candidateResumeInfo")
    List<SelectedResumes> selectedResumes;
    

    SelectedResumes.java:

    @ManyToOne
    @JoinColumn(name="candidate_resume_info_id")
    CandidateResumeInfo candidateResumeInfo;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables (tbArea, tbPost) that relate to the following classes. class Area
USING MySQL. I have two tables. Table A, and Table B. Table A has
I need to create a table (possibly a view) that relates two tables, one
I have two tables points and contacts and I'm trying to get the average
I have a query that performs a UNION between two tables. I'm trying to
Hi I have two tables User and Pictures im trying to pull the pathname
I am trying to select from the join of the two related tables in
I have two large tables, as follows: First Table: tbl_properties id address city state
I'm trying to join two tables, but having an error: Unknown record property /
I am trying to get data from two related tables in a single query.

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.