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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:20:39+00:00 2026-05-14T02:20:39+00:00

I have my domain object, Client , I’ve got a form on my JSP

  • 0

I have my domain object, Client, I’ve got a form on my JSP that is pre-populated with its data, I can take in amended values, and persist the object.

Client has an abstract entity called MarketResearch, which is then extended by one of three more concrete sub-classes.

I have a form to pre-populate some MarketResearch data, but when I make changes and try to persist the Client, it doesn’t get saved, can someone give me some pointers on where I’ve gone wrong?

My 3 domain classes are as follows (removed accessors etc)

public class Client extends NamedEntity
{
    @OneToOne
    @JoinColumn(name = "MARKET_RESEARCH_ID")
    private MarketResearch marketResearch;
    ...
}


@Inheritance(strategy = InheritanceType.JOINED)
public abstract class MarketResearch extends AbstractEntity
{
  ...
}

@Entity(name="MARKETRESEARCHLG")
public class MarketResearchLocalGovernment extends MarketResearch
{

    @Column(name = "CURRENT_HR_SYSTEM")
    private String currentHRSystem;
    ...
}

This is how I’m persisting

public void persistClient(Client client)
{
    if (client.getId() != null)
    {
        getJpaTemplate().merge(client);
        getJpaTemplate().flush();
    } else
    {
        getJpaTemplate().persist(client);
    }
}

To summarize, if I change something on the parent object, it persists, but if I change something on the child object it doesn’t. Have I missed something blatantly obvious?

I’ve put a breakpoint right before the persist/merge calls, I can see the updated value on the object, but it doesn’t seem to save. I’ve checked at database level as well, no luck

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-14T02:20:40+00:00Added an answer on May 14, 2026 at 2:20 am

    You need to set a proper cascade option on @OneToOne in order to get your operations cascaded:

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "MARKET_RESEARCH_ID") 
    private MarketResearch marketResearch; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic domain object, say like Person or Campaign or Event that
I have a property on a domain object that is declared in a many-to-one
I have the current basic structure for each domain object that I need to
So let's say we have a domain object such as the following public class
Let's say I have an interface representing a domain object: public interface IFoo {
I have a collection of domain objects that I need to convert into another
I have a domain class containing a couple of fields. I can access them
I have a domain and a group of sub-domains that require authentication to access.
My use case is simple. I have a root domain object which references a
I've written myself a nice simple little domain model, with an object graph that

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.