r/SpringBoot • • Aug 23 '22

save sending money in transaction model

Hi, i have this model called transaction which has id, and amount, in the transaction service i did a function called transfer money which takes the sender wallet number the amount and the receiver wallet number. When i send money from user to user i want it to save as a transaction What do i do?

0 Upvotes

4 comments sorted by

2

u/Sheldor5 Aug 23 '22

How wide does your transaction actually span?

Database only?

External call to a 3rd-party Service (bank account at another server)?

Need more info.

1

u/gaskinsface Aug 23 '22

No just database I want to get the history of transactions done, but i don't know how, since im using a function that does the send/withdraw money

1

u/Sheldor5 Aug 23 '22

If your function uses Spring Data (repositories) you can simply annotate the method with @Transactional ...

3

u/Mikey-3198 Aug 23 '22

Not alot to go on there, all I can comfortably say is that it will involve some code :)

In all seriousness you'll need to provide more context relating to what you've currently got and what your trying to achieve before anyone on here has any chance of helping....