On saveAndFlush, changes will be flushed to DB immediately in this command. With save, this is not necessarily true, and might stay just in memory, until flush or commit commands are issued.
But be aware, that even if you flush the changes in transaction and do not commit them, the changes still won't be visible to the outside transactions until the commit in this transaction.
In your case, you probably use some sort of transactions mechanism, which issues commit command for you if everything works out fine.

本文深入探讨了OnsaveAndFlush与Save命令在数据库操作中的区别,解释了事务机制如何确保数据的一致性和完整性。重点强调了即使在事务中使用flush命令,数据的可见性仍取决于最终的commit操作。
1933

被折叠的 条评论
为什么被折叠?



