Well, how does the transaction knows when to rollb...
# orm-help
a
Well, how does the transaction knows when to rollback? I assume it catches an error emited by Prisma when creating and if you add a try catch you are stopping the error propagation
b
thanks for reply. I add "await" in test2. but the result is also same. test1 function try to create one record which has existed in database . so it will cause an error. the transaction should rollback.
additional. I find prisma and typeorm use try catch block will stop the error propagation in transaction like you said. but in java spring framework. it has "rollback only" , though you use try catch block , the transaction will rollback. maybe the mechanism of framework is different
a
I would forget everything you know about Java. Trust me it's easier sometimes to learn from "0". If you need to do some extra logic in those catch. may try throwing the same error produced by "create" again. If that doesn't work go to the source code to see how does the rollback works in the transaction
b
yeah. you are right