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

Task doesn't use transaction manager on startup #438

Open
Tim-Tom opened this issue Aug 3, 2018 · 1 comment
Open

Task doesn't use transaction manager on startup #438

Tim-Tom opened this issue Aug 3, 2018 · 1 comment

Comments

@Tim-Tom
Copy link

Tim-Tom commented Aug 3, 2018

This could be intended behavior, but when an spring cloud task is starting up, it doesn't use the transaction manager when initializing the execution.

Take as an example spring-cloud-task-samples/multiple-datasources. If we change the secondDataSource to disable autocommit, the application will immediately fail on startup because the creation of the execution will be rolled back immediately. after creating it.

	@Bean
	public DataSource secondDataSource() throws SQLException {
		DataSource ds = new EmbeddedDatabaseBuilder()
				.setType(EmbeddedDatabaseType.H2)
				.build();
		SimpleDriverDataSource sdds = ds.unwrap(SimpleDriverDataSource.class);
		Properties properties = new Properties();
		properties.setProperty("autoCommit", "false");
		sdds.setConnectionProperties(properties);
		return ds;
	}

So either all the initialization code should get wrapped in transaction(s), or the documentation should be updated to reflect that you only support data sources with auto-commit set to true.

@mminella
Copy link
Contributor

mminella commented Aug 8, 2018

This seems to be a bug in that the @Transactional annotations are on the interfaces and not on the concrete methods. Since Spring uses dynamic subclassing for the default proxy mechanism these days, it's probably not getting applied. Thanks for reporting this.

@sabbyanandan sabbyanandan added this to the 2.0.1.RELEASE milestone Aug 8, 2018
@sabbyanandan sabbyanandan modified the milestones: 2.0.1.RELEASE, 2.1.0.M1 Aug 29, 2018
@sabbyanandan sabbyanandan modified the milestones: 2.1.0.M1, 2.1.0.M2, 2.1.0.RC1 Nov 5, 2018
@sabbyanandan sabbyanandan modified the milestones: 2.1.0.RC1, 2.1.0.RELEASE Dec 5, 2018
@sabbyanandan sabbyanandan modified the milestones: 2.1.0.RELEASE, 2.1.0.RC1 Jan 2, 2019
@sabbyanandan sabbyanandan removed this from the 2.1.0.RC1 milestone Jan 16, 2019
@sabbyanandan sabbyanandan added this to the 2.2.0.M1 milestone Feb 13, 2019
@sabbyanandan sabbyanandan modified the milestones: 2.2.0.M1, 2.2.0.RC1 Apr 25, 2019
@sabbyanandan sabbyanandan modified the milestones: 2.2.0.RC1, 2.2.0.RELEASE Aug 14, 2019
@sabbyanandan sabbyanandan removed this from the 2.2.0.RELEASE milestone Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants