jakartaee / transactions

Welcome to the Jakarta EE Transactions API Project (formerly JTA)
https://jakartaee.github.io/transactions/
Other
28 stars 29 forks source link

@Transactional should support local transaction like Spring #190

Open hantsy opened 3 years ago

hantsy commented 3 years ago

Like Spring, in a none-EJB and none-JTA, @Transactional should support JPA RESOURCE_LOCAL type persistence context seamlessly in a CDI SE and Servlet/CDI environment.

Besides, add possible to configure transaction support(@Trasnactional) from DataSource for JDBC scenes. Like the Spring DataSource and DataSourceTransactionManager.

I think the Apache DeltaSpike project has done some work like this in the past years. https://deltaspike.apache.org/documentation/data.html#Transactions

Related to https://github.com/eclipse-ee4j/jpa-api/issues/309.

tomjenkinson commented 3 years ago

Thank you for your suggestion! Unfortunately I am not too clear on what you are suggesting to be added to the Jakarta Transactions project to accomplish the suggestion - please can you elaborate on what the change would look like from the Jakarta Transactions api/specification point of view?

hantsy commented 2 years ago

@tomjenkinson I would like to port the TransactionStrategy of Apache DeltaSpike to Jakarta EE, and make CDI compatible @Transactional annotation(declaration approache) and UserTransaction(or something new class for programmatic approach) works with JTA or local transaction(non-JTA).

For example, in a servlet container, there is a DataSource CDI bean declared, create a local DataSource based transaction strategy, and developers can use @Transactional directly(Currently it does not work in this case).

tandraschko commented 2 years ago

+1, really a important feature when just using CDI + JPA

tomjenkinson commented 2 years ago

Thank you for providing feedback, please can I suggest to create a discussion on the Jakarta Transactions developer mailing list: https://accounts.eclipse.org/mailing-list/jta-dev ?