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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:51:37+00:00 2026-06-13T08:51:37+00:00

Following is the table structure: desc customer_survey Name Null Type ———– ——– ———— SURVEYID

  • 0

Following is the table structure:

desc customer_survey
Name        Null     Type         
----------- -------- ------------ 
SURVEYID    NOT NULL VARCHAR2(10) 
CUSTNO      NOT NULL VARCHAR2(10) 
SRNO                 NUMBER(10)   
AVGRATINGS           NUMBER(5,2)  
COMMENTS             VARCHAR2(50) 
SENTON               DATE         
RESPONDEDON          DATE         

desc Survey_response
Name             Null     Type         
---------------- -------- ------------ 
SURVEYRESPONSEID NOT NULL NUMBER(10)   
RATINGS          NOT NULL NUMBER(2)    
QNO              NOT NULL VARCHAR2(10) 
SURVEYID         NOT NULL VARCHAR2(10) 

Java classes:

 public class CustomerSurvey implements Serializable {

@OneToMany(fetch=FetchType.EAGER, mappedBy="customerSurvey", 
     cascade=CascadeType.ALL)
private Set<SurveyResponse> responses;
 ......

 public class SurveyResponse {

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="SURVEYID", referencedColumnName="surveyId")
private CustomerSurvey customerSurvey;

 ......

Client code:

 List<CustomerSurvey> surveys = workService.getSurveysByCustomer("testCNo2");
 System.out.println("surveys size = " + surveys.size());

 for(CustomerSurvey survey: surveys) {
System.out.println("getting responses from the survey object now..");
Set<SurveyResponse> responses = survey.getResponses();
System.out.println("responses size= .." + responses.size());
 }

console shows:

surveys size = 1
getting responses from the survey object now..
responses size= ..0

whereas there are 7 responses in the DB for the selected survey.

  • 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-13T08:51:38+00:00Added an answer on June 13, 2026 at 8:51 am

    this link helped.
    I set the collection back to lazy. And
    Inside persistence class, within transaction after getting the resultset, I am now calling getResponses as:

    List<CustomerSurvey> surveys = query.getResultList();
    for (CustomerSurvey survey : surveys) {
        Set<SurveyResponse> responses = survey.getResponses();
    }
    

    that populates the responses.

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

Sidebar

Related Questions

I have the following table structure: +----------+------------------------+------+-----+------------------------------------------+----------------+ | Field | Type | Null |
I have the following table structure: ORGANIZATION_ID | Name | PARENT_ID -------------------------------------------------- 1 |
I have the following database structure: Sites table id | name | other_fields Backups
I have a table with the following basic structure. unique_id | name | original
Given the following table structure: CREATE TABLE IF NOT EXISTS `roles` ( `id` int(11)
Consider the following table structure: id name rank position ------------------------------- 1 Steve 5 0
I have a table with the following structure, FIELD TYPE EXTRA faciltiy_id int auto_increment(Primary
I have following table structure in my DB ID Name -------------------------- ID_1 Name1 ID1
I have the following MySQL Table Structure: mysql> desc customers; +---------------------+-------------+------+-----+---------+-------+ | Field |
I have the following table structure: ID | fname | lname | street |

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.