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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:32:52+00:00 2026-05-13T10:32:52+00:00

I am working on a API to access data stored in a system. The

  • 0

I am working on a API to access data stored in a system. The system contains things like people, appointments and procedures associated with those appointments. My application will strictly be read-only.

I am using Spring w/ RowMapper to build objects such a “Person“, “Appointment” and “Procedure“. I have a DAO for each element. (ie: PersonDAO.getById(), PersonDAO.getByName(), ..).

The issue comes in that Appointment has a reference to a Person object. An it would be nice in the Person object to have a reference to that Person‘s appointments, but if I begin to load these it becomes a circular reference.

So, I guess my question is the right way to handle this just put the references (Ids) in the POJOs and then have the business layer(?) just make the right calls to get the information? Or is it ok to somehow pass around a reference to the DAO in the actual POJO so that I can lazily load the object objects when referenced? But then how do you handle the circular reference? When I have a Person and I lazily load all their appointments, those appointments will also have a Person associated with them. When I load this Person it could potentially have difference information from the Person I am loading Appointments for.

Person (object x) lazily load -> Appointments could lazily load Person (object x’).

Since Person could have changed by the time I went to lazily load their appointments. I really need the Person object in Appointment to refer back to the same Person object.

I’m getting all caught up on this. I know I could just “make it work”, but I want to try and find a good solution. I was thinking about using hibernate for this, but thought it was really just overkill. Maybe it isn’t.

  • 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-13T10:32:52+00:00Added an answer on May 13, 2026 at 10:32 am

    You’re describing a bidirectional association, which Hibernate has specific (and generally very good) support for.

    Read up on how to do it in the docs.

    Rolling this by hand is going to be quite fiddly and bug-prone. I wouldn’t recommend it. Use the the power of ORM tools like Hibernate, that’s what they’re there for.

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

Sidebar

Ask A Question

Stats

  • Questions 402k
  • Answers 402k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use GLSL and OpenGL in Java through JOGL. May 15, 2026 at 4:58 am
  • Editorial Team
    Editorial Team added an answer Hmya, everybody really likes a tool that will tell them… May 15, 2026 at 4:58 am
  • Editorial Team
    Editorial Team added an answer Try: curl http://datastream.com/data > output_file.txt May 15, 2026 at 4:58 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.