You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think spring-transaction with DAO api is working incorrectly. If you try to insert two rows inside the same transactions where the latter one is invalid, neither of the records should be inserted. With DAO api the first one is inserted in DB.
This can be tested out in the repro repo I made. The repro repo has 2 tables: posts and comments. Post has many comments and comment belongs to a post. The failure in all examples is that I try to create one Post row and one Comment row without attaching the comment to the Post. Failing code can be found here. A few lines below there is a DSL approach which works correctly. You can query the data with the controller. If you go to localhost:8080/posts/ there are no posts. After this if you go to localhost:8080/posts/dao in shows an error. After this if you go back to index action you can see that an Post was created.
I also tried this with exposed transaction { } block and there everything is working as expected. Repo can be found here.
The text was updated successfully, but these errors were encountered:
Hi,
I think spring-transaction with DAO api is working incorrectly. If you try to insert two rows inside the same transactions where the latter one is invalid, neither of the records should be inserted. With DAO api the first one is inserted in DB.
This can be tested out in the repro repo I made. The repro repo has 2 tables: posts and comments. Post has many comments and comment belongs to a post. The failure in all examples is that I try to create one Post row and one Comment row without attaching the comment to the Post. Failing code can be found here. A few lines below there is a DSL approach which works correctly. You can query the data with the controller. If you go to
localhost:8080/posts/
there are no posts. After this if you go tolocalhost:8080/posts/dao
in shows an error. After this if you go back to index action you can see that an Post was created.I also tried this with exposed
transaction { }
block and there everything is working as expected. Repo can be found here.The text was updated successfully, but these errors were encountered: