I currently work on this. Some tests are still missing. So I plan to send a pull request soon. Please test with: https://github.com/KeDevServices/guice/tree/fb_javax_transactional
—
Reply to this email directly or view it on GitHub.
There is a Java version conflict. By now guice support Java 6.
I integrate @javax.transaction.Transactional defined by JTA1.2 by adding the following dependency:
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.2</version>
</dependency>
But the provided javax.transaction.Transactional annotation is build on java 7:
java.lang.UnsupportedClassVersionError: javax/transaction/Transactional
at com.google.inject.persist.PersistModule.configure(PersistModule.java:46)
at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:253)
at com.google.inject.AbstractModule.install(AbstractModule.java:122)
at com.google.inject.persist.EdslTest$1.configure(EdslTest.java:20)
at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:253)
So, integration of jta1.2 annotation will break support for java 6.
Any idea how to deal with this? (cf. https://github.com/KeDevServices/guice/tree/fb_javax_transactional)
You could add support using reflection, but it would make the code more complicated and make testing harder. I personally would be OK with making the persist extension require Java7 at a minimum -- I think we've kept Java6 primarily for folks still using it on Android, but it's unlikely that Android folks are using the persist extension. Maybe send an email to the user list and ask if anyone has objections to making Java7 a minimum req for the persist extension?
... maybe more to the point, though, does anything in the library actually require java7? Are there any other libraries that aren't built with java7 as the class version but do offer the class?
There is the following lib that can be considered:
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
But using it results in the same problems as above (it is also build based on java 7).
Any change of getting this in Guice 4 ? We really need to extra control over transactions that the current implementation does not support at this moment (RequiresNew f.ex)