Forums Register Login

Constructing object

+Pie Number of slices to send: Send
Hi,

I have a query in constructing an object and storing it in database in json format.

Its in air domain industry. Need to construct an ojbect and store it in database in json format so the other applications can use the same object for various test automation scripts.

What i have done is i have created a class called PassengerDetails and inserted to station, from station etc., as below.


The passenger type also changes, like infants, companions etc., and i am not understanding how to handle it in class PassengerDetails. I have a guess like i have to add another class for PassengerType. Please correct me if i am wrong and suggest me how to add that passengertype details.

And I have created one ticket class (one ticket for each passenger, if 3 adults are there then 3 tickets and and three tickets are associated with one unique PNR). Here we have to store how the ticket is purchased, i mean by cash or credit card




We are having different payment types like Creditcard, cash, vouchers, refund amount etc., I am in confusion again how to handle this in the above PaymentDetails Class and how to link this class with TicketInformation and PassengerDetails




For multiple tickets, we have one PNR.



Now i have a query like, if there is modification in flights or dates etc., new ticket will be issued. Now the question is how to store this new tickets and old tickets so that the user who retrieves the list of tickets can understand that there is a modification and hence there are new tickets and old tickets.

The other scenario is that if there is an addition of additonal passenger then not only the ticket changes but also the PNR changes, Now the question is i want to store both new and old PNRs and associated tickets.

For multiple PNR's how to write the class, do i have to write a class where it has List<PNRDetails> as instance variable. I messed up the code and i am in confusion. Could any one suggest better approach in modifications of code.


Thanks & Regards,

Swapna.




+Pie Number of slices to send: Send
Just from design point of view, it would be better if you just write down all the business requirements in a paper and just take your time to visualize how it should work as per your understanding.

Json is just a data format, it will not be a blocker for your application. From what I remember from my previous projects, you can have objects of objects also. Analogy would be use of composition I guess.

Storing and retrieval would be frequent in your case, hence you should design it in such a way that there or no unnecessary data conversions from application to db and db to application.

I am no db expert, but in layman way if I have a column in my db that either links to any previous ticket/ record or a column that tells that this row is updated, that should prove to be quite useful.
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 261 times.
Similar Threads
Using Detached Criteria on two POJO classes
hibernate : child changes but parent doesnt know
How do you serialize different fields to json depending on the circumstances?
Spring MVC jodatime localdate object format in json response
A small project to develop online flight ticket booking
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:58:38.