Christian
Christian

Reputation: 4084

Get rid of Guice Dependency

I have following class

  public class TransactionalTest {
    @javax.inject.Inject
    EntityManager em;

    @com.google.inject.persist.Transactional
    public void insertSomeData() {
      Preferences p0 = new Preferences();
      p0.setTemplatename("pref 01");
      em.persist(p0);
    }   
   }

I am using javax.inject.Inject instead of com.google.inject.Inject. What is the correct annotation for Transactional, thus I have no dependencies to Guice?

Upvotes: 0

Views: 325

Answers (1)

Riduidel
Riduidel

Reputation: 22292

From my memories, you will have to write your own annotation.

However, if you're in a JavaEE system, youc an use EJB TransactionAttribute. There also exist some CDI extensiosn, like Seam Solder or Apache DeltaSpike that may in a distant future provide such code outside of JavaEE containers.

Upvotes: 2

Related Questions