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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:48:06+00:00 2026-06-14T01:48:06+00:00

Lets say you had an entity called Bus. In that entity you have a

  • 0

Lets say you had an entity called Bus. In that entity you have a list of passengers. In the UI you select the passengers that will be in the Bus. After all the passengers have been added to the bus you submit the page. Server side you get The Bus entity and you get a list of ids that represents the passengers. Do I really have to look up all these passengers and set the list of passengers on the Bus before I save the Bus. I haven’t changed any information about the passengers themselves and would hate to have to do the database hit if its not needed.

Searching around I have seen people using the entity manager find() to do this, but I am not sure how I would do that with spring-data.

Ideally it would be nice to just set this list of ids on the json object I send up and use some annotation on the Bus entity so that it knows to expect ids when saving the passenger list on the Bus entity.

I am fairly new to JPA so feel free to point me to the correct words to search on google. I am just not sure how to go about doing something like 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-06-14T01:48:08+00:00Added an answer on June 14, 2026 at 1:48 am

    With spring data it uses the merges so all I had to do is save the bus with a newly created list of passengers that only had the id set on them. No need to look them up, just create a new object and set the id on it and then save. It is as easy as that.

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

Sidebar

Related Questions

Lets say i had a a button that cycles through numbers how can i
So lets say I had a string that was <html> <head><title>301 Moved Permanently</title><head> and
Let's say I had one entity called Garage and one entity called Cars. In
Lets say I have List<string> = new List<string>() {20,26,32} I want to create a
lets say I have a list like so: ['one','two','three','four','five','six','seven','eight','nine'] and I want to experiment
I have an ASP.NET website project that until recent had all code in App_Code
I have a linked list of structures. Lets say I insert x million nodes
Lets say you had something that was going to stay changed for a while,
Let's say I had: protected void performLogic(List<Object> docs) { ... } In the code
Let's say I wrote a program containing an algorithm that had an exponential runtime

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.