L'obtention de Transaction qui n'est pas démarré avec succès une exception à l'aide de Spring Hibernate

J'ai un UserProfile entité dont j'ai besoin pour économiser de l'. après l'enregistrement de l'entité dans la base de données, j'obtiens l'exception suivante:

Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully started

Aussi quand je vois la table de l'entité est conservé au lieu de faire un rollback!

@Transactional(isolation=Isolation.REPEATABLE_READ)
public class HibernateUserProfileDAO implements UserProfileDAO {
    private org.hibernate.SessionFactory sessionFactory;
    public UserProfile getUserProfile(int userId) {
        org.hibernate.classic.Session session = sessionFactory.getCurrentSession();
        session.beginTransaction();
        UserProfile userProfile = new UserProfile();
        userProfile.setUserName("sury1");
        session.save(userProfile);
        session.getTransaction().commit();
        session.close();
        return userProfile;
    }
}

Je suis en utilisant hibernate gestionnaire de transactions

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>

et mon hibernate config est:

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="packagesToScan" value="com.springheatmvn.domain"/>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.connection.pool_size">10</prop>
            <prop key="hibernate.connection.show_sql">true</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>
        </props>
    </property>     
</bean>

Quelqu'un peut-pl. dites-moi ce qui se passe ici?

@user354161 voir édité réponse et commentaire de Bozho

OriginalL'auteur tintin | 2011-09-20