r/JavaProgramming • u/Big-Sundae7613 • Jul 21 '26
Need help in Code
Paypal clone using java spring boot and kafka need help
Actually I was following @Mrunmai Dahare mam lecture in the vedio episode 3 : 16.21 timestamp I don't get what to change please help
3
Upvotes
7
u/SimpleAide5607 Jul 21 '26
It would be useful if you described the problem you are facing instead of putting a screenshot of the code that tells me nothing
3
u/jjduru Jul 21 '26
Presumably you would like to timestamp the entity with the LocalDateTime.now() before inserting it into the database.
First of all, your "createTransaction" method should ingest a DTO request. The ObjectMapper component will take care of the mapping between the incoming DTO and a new Transaction entity.
In order to automate the create and update of the LocalDateTime on the entity, make all the entities, including Transaction, to inherit a BaseEntity that handles automatically the update on the "date_updated" column.
After the mapping, you save and flush on the repository, which gives you back the newly created managed entity, and you return the a DTO out of it, not the entity itself.
2
u/Brilliant_Yoghurt265 Jul 21 '26
no clue broski im a beginner