Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring transaction & DAO API #666

Closed
harjis opened this issue Oct 28, 2019 · 0 comments
Closed

Spring transaction & DAO API #666

harjis opened this issue Oct 28, 2019 · 0 comments
Labels

Comments

@harjis
Copy link

harjis commented Oct 28, 2019

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 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.

@Tapac Tapac added the bug label Nov 17, 2019
Tapac added a commit that referenced this issue Nov 23, 2019
@Tapac Tapac closed this as completed Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants