Aucune transaction commence au Printemps @Transactional méthode

Je rencontre un problème étrange, tout en développant l'application à l'aide de Printemps (3.0.5), mise en veille prolongée (3.6.0) et de Guichet (1.4.14). Le problème est: je ne peux pas enregistrer ou modifier n'importe quel objet dans la base de données. Par "impossible", je veux dire que tous les changements dans l'objet ou les appels à l'EntityManager.persist(foo) sont simplement ignorées silencieusement. Sélectionne travail.

Échantillon de cas est simple: sur certains guichet de la page j'essaie d'enregistrer l'objet dans la base de données, comme suit

public class ComicDetailsPage extends PublicBasePage {

@Override
protected void onConfigure() {
    System.out.println("In onConfigure");
    super.onConfigure();
    comicDAO.insert("abc");

}

@SpringBean(name="comicDAO")
private ComicDAO comicDAO;

    (....)

Ici est comicDAO

@Service
public class ComicDAO {

@PersistenceContext
private EntityManager em;

(...)

@Transactional
public void insert(String title) {
    Comic c = new Comic();
    c.setTitle(title);
    em.persist(c);
}

@Transactional
public Comic add1toTitle(int pk) {
    System.out.println("Beginning fetching");
    Comic c = em.find(Comic.class, pk);
    System.out.println("Fetched updating");
    c.setTitle(c.getTitle()+"1");
    System.out.println("Updated persisting");
    em.persist(c);
    System.out.println("Persisted returning");
    return c;
}

Je n'ai pas activé la journalisation et voici la partie pertinente de journaux (à la fois en veille prolongée et le Printemps sont mis à la TRACE). J'ai ajouté ** pour les lignes a, je pense, important ici.

In onConfigure
01:53:19.330 [qtp2119047503-15] DEBUG o.s.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'txManager'
**01:53:19.330 [qtp2119047503-15] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 13006687993**
**01:53:19.330 [qtp2119047503-15] DEBUG org.hibernate.transaction.JDBCTransaction - begin**
01:53:19.330 [qtp2119047503-15] DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
01:53:19.335 [qtp2119047503-15] DEBUG org.hibernate.transaction.JDBCTransaction - current autocommit status: true
01:53:19.335 [qtp2119047503-15] DEBUG org.hibernate.transaction.JDBCTransaction - disabling autocommit
01:53:19.336 [qtp2119047503-15] TRACE org.hibernate.jdbc.JDBCContext - after transaction begin
01:53:19.336 [qtp2119047503-15] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 13006687993
01:53:19.336 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - setting flush mode to: AUTO
01:53:19.336 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - setting cache mode to: NORMAL
01:53:19.337 [qtp2119047503-15] TRACE org.hibernate.engine.IdentifierValue - id unsaved-value: 0
01:53:19.337 [qtp2119047503-15] TRACE org.hibernate.event.def.AbstractSaveEventListener - transient instance of: pl.m4ks.comics.entity.Comic
01:53:19.337 [qtp2119047503-15] TRACE org.hibernate.event.def.DefaultPersistEventListener - saving transient instance
**01:53:19.338 [qtp2119047503-15] TRACE org.hibernate.event.def.AbstractSaveEventListener - saving [pl.m4ks.comics.entity.Comic#<null>]**
**01:53:19.341 [qtp2119047503-15] DEBUG org.hibernate.event.def.AbstractSaveEventListener - delaying identity-insert due to no transaction in progress**
01:53:19.341 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - closing session
01:53:19.341 [qtp2119047503-15] TRACE org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action
01:53:19.341 [qtp2119047503-15] DEBUG org.hibernate.transaction.JDBCTransaction - commit
**01:53:19.341 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - automatically flushing session**
01:53:19.341 [qtp2119047503-15] TRACE org.hibernate.jdbc.JDBCContext - before transaction completion
01:53:19.341 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - before transaction completion
01:53:19.342 [qtp2119047503-15] DEBUG org.hibernate.transaction.JDBCTransaction - re-enabling autocommit
01:53:19.342 [qtp2119047503-15] DEBUG org.hibernate.transaction.JDBCTransaction - committed JDBC Connection
01:53:19.342 [qtp2119047503-15] TRACE org.hibernate.jdbc.JDBCContext - after transaction completion
01:53:19.342 [qtp2119047503-15] DEBUG org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
01:53:19.342 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - after transaction completion
01:53:19.342 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - closing session
01:53:19.342 [qtp2119047503-15] TRACE org.hibernate.jdbc.ConnectionManager - performing cleanup
01:53:19.342 [qtp2119047503-15] DEBUG org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
01:53:19.342 [qtp2119047503-15] TRACE org.hibernate.jdbc.JDBCContext - after transaction completion
01:53:19.342 [qtp2119047503-15] DEBUG org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
01:53:19.342 [qtp2119047503-15] TRACE org.hibernate.impl.SessionImpl - after transaction completion

Bien sûr, Aucun objet n'est enregistré dans la base de données.

Le dernier fichier - mon applicationCOntext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans (...)>
<context:component-scan base-package="pl.m4ks.comics"/>
<context:annotation-config /> 
<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:8889/comics" />
<property name="username" value="root"/>
<property name="password" value="root" />          
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="main" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="packagesToScan">
<value>pl.m4ks.comics</value>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<tx:annotation-driven transaction-manager="txManager"  proxy-target-class="true"/>
</beans>

Je n'ai aucune idée de ce que peut être le problème et comment le résoudre. Je ne veux pas gérer les transactions dans mon code c'est ce que le Printemps est pour.

Quel est le type réel de la dao dans le guichet de la classe (système de la .getClass()). Et ce que les constructeurs ne les DAO ont?
Retiré de guichet tag que ce n'est pas pertinent pour cette question (votre problème n'est pas dans votre code guichet). Ajouté Java et JPA tags

OriginalL'auteur M4ks | 2011-03-21