spring boot with jpa repository #110
Unanswered
ummisyafiqahmd
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Good day everyone,
so i am new to spring boot and also java. I have two table which are ticket table (tid(PK), type, status, createdAt, updateAt) and history table (hid(PK), status, createAt, tid(FK)). i applied @onetomany relationship and @joincolumn with JPA. The flow is i have to insert tickets table first then whenever i want to update ticket table i have to copy the previous data into history first. then the parent table will retrieve the latest value only. i have done that with native query ->INSERT INTO history(status, createAt, tid) SELECT tickets.status, tickets.updateAt, tickets.tid FROM tickets WHERE tickets.tid= :tId; its works if i execute directly in database. so iam here to get some ideas on how to apply in spring boot on passing parameter in method through controller, service.
All reactions