Re: [guice] Add support for @javax.transaction.Transactional (#797)

17 views
Skip to first unread message

Joachim Klein

unread,
Oct 11, 2014, 11:28:18 AM10/11/14
to google/guice

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.

Joachim Klein

unread,
Oct 13, 2014, 10:01:30 AM10/13/14
to google/guice

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)

Sam Berlin

unread,
Oct 13, 2014, 10:56:36 AM10/13/14
to google/guice

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?

Sam Berlin

unread,
Oct 13, 2014, 10:59:23 AM10/13/14
to google/guice

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

Joachim Klein

unread,
Oct 14, 2014, 8:58:26 AM10/14/14
to google/guice

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

dnouls

unread,
Apr 15, 2015, 5:15:00 AM4/15/15
to google/guice

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)

Reply all
Reply to author
Forward
0 new messages