JPAContainer - no transaction is in progress

Hi, i’ve been trying to use JPAContainer with a JTA datasource in JBoss, but i keep getting this error when commiting a FieldGroup: “no transaction is in progress”

Here’s my persistence.xml[code]


org.hibernate.ejb.HibernatePersistence
java:jboss/datasources/Pagamento

  <class>br.com.edu.entidades.Usuario</class>
  
  <properties>
     <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"></property>         
     <property name="hibernate.cache.use_second_level_cache" value="false"></property>
     <property name="hibernate.hbm2ddl.auto" value="update"></property>
     <property name="hibernate.show_sql" value="false"></property>  
     <property name="hibernate.format_sql" value="true"></property>
  </properties>
[/code] I'm also using a custom EntityProvider in order to support JTA: [code] public class EduEntityProvider extends MutableLocalEntityProvider {
private EntityManager em = HibernateUtils.entityManager;

public EduEntityProvider() {
    super(Usuario.class);
    setEntityManager(em);

    setEntitiesDetached(false);
    setTransactionsHandledByProvider(false);
}

@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
protected void runInTransaction(Runnable operation) {
    super.runInTransaction(operation);
}    

}
[/code]The Entity:

@SuppressWarnings("serial")
@Entity
@Table(name="usuario")
public class Usuario extends EduPersistentEntity {

    @Id
    @Column(name="id")
    @VisivelTabela(false)
    private String id;
    
    @Column(name="nome")
    private String nome;
    
    @Column(name="email")
    private String email;
    
    @Column(name="senha")
    private String senha;
        
    @Column(name="matricula", unique=true)
    private String matricula;

    gets... 
    sets...
}

If I set the transaction handled by provider to true “setTransactionsHandledByProvider(false);”, i’ll get the error " A JTA EntityManager cannot use getTransaction()".

If anybody could point me to a working example or just give me a hint about what i’m doing worng, would be much appreciated.

Thanks

Anybody?

I have only one answer:
Don’t use JPAContaiener
. Seriously.

cheers,
matti

Yeah, at first it seemed like a great idea to use JPAContainer, but the last few weeks using it has proven it to be garbage.
Anyway, thanks for the tip Matti!