₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,148 members, 8,448,865 topics. Date: Tuesday, 21 July 2026 at 12:01 AM

Toggle theme

How Do I Go About This System Design ? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHow Do I Go About This System Design ? (621 Views)

1 Reply (Go Down)

How Do I Go About This System Design ? by sweetguy10(op): 6:53pm On Aug 07, 2022
Good day everyone , I have this Java/Spring boot project where I need to return objects values in XML . The thing is most of the variables to be returned have their fixed final variables values already , how do I go about not persisting them in the database but can call them anytime that I need to add them up to a payload for a POST operation? This is a sample of how the response payloads should be like .

<person>
<contact>
<number>09087431264</number>
<age>30</age>
</contact>
</person>

As you can see the number and age fields in the contact class are fixed final variables inside the person object which is an entity. I used @Embeddable and @Embedded to add the Contact class to the Person entity but it added the column : Number and Age to the Person entity and making a REST call to the Person entity will not return the person entity with the XML schema as posted above . Inputs and help will be greatly appreciated .

@richebony your input as well will be greatly appreciated sir thanks much.
Re: How Do I Go About This System Design ? by richebony: 9:34am On Apr 07, 2023
sweetguy10:
Good day everyone , I have this Java/Spring boot project where I need to return objects values in XML . The thing is most of the variables to be returned have their fixed final variables values already , how do I go about not persisting them in the database but can call them anytime that I need to add them up to a payload for a POST operation? This is a sample of how the response payloads should be like .

<person>
<contact>
<number>09087431264</number>
<age>30</age>
</contact>
</person>

As you can see the number and age fields in the contact class are fixed final variables inside the person object which is an entity. I used @Embeddable and @Embedded to add the Contact class to the Person entity but it added the column : Number and Age to the Person entity and making a REST call to the Person entity will not return the person entity with the XML schema as posted above . Inputs and help will be greatly appreciated .

@richebony your input as well will be greatly appreciated sir thanks much.
lol do u know i am just seeing this shit now, anyways heres my take if it would help anyone facing a similar problem . I think using @Embbeded just injects fields parameters to a parent class creating columns on the fly. using @Transient may help


@Entity
public class Person{

@Id
private Integer id;

// native fields

@Transient
public Contact contact

// getters and setters
}
Re: How Do I Go About This System Design ? by Deicide: 7:06pm On Apr 07, 2023
XML why?
Re: How Do I Go About This System Design ? by CodeTemplar: 7:48pm On Apr 07, 2023
There is an SQL formula for age calculation and.an annotation for it within your Bean. I can't remember now. DOB is fixed so the an notion takes the date of birth and su tract current date from it them divide by 365 to get age.

I suspect OP is just cruising.

You could also implement the logic inside the getter method of the age field.
1 Reply

I Want My Son To Be A Programmer, How Do I Go About ItBackend Software Engineers, Let's Talk About System DesignShould I Go For Cybersecurity Or Computer Science?234

The OI/AI Integration Blueprint (personal Use Only)Website Development Training. Hurry NowLets Get 1000 Youtube Subcribers.