codice:
public void saveOrUpdate(Object entity) throws DataAccessException {
         getHibernateTemplate().saveOrUpdate(entity);
}
con Hibernate3, Spring3, Jboss 5, funziona mentre con Hibernate5 (Spring5, Jboss7) ho questo errore


14:04:02,274 ERROR [stderr] (default task-6) org.springframework.dao.InvalidDataAccessApiUsageE xception: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
14:04:02,274 ERROR [stderr] (default task-6) at org.springframework.orm.hibernate5.HibernateTempla te.checkWriteOperationAllowed(HibernateTemplate.ja va:1093)
...


cambiando il codice in


codice:
public void saveOrUpdate(Object entity) throws DataAccessException {
          
         Session sessionOne = getSessionFactory().openSession();
         sessionOne.beginTransaction();
         sessionOne.saveOrUpdate(entity);  
         sessionOne.getTransaction().commit();
         sessionOne.close();
}
funziona




definizione bean nella vecchia config:
codice:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.format_sql">false</prop>
            <prop key="hibernate.jdbc.fetch_size">100</prop>
            <prop key="hibernate.jdbc.batch_size">50</prop>
            <prop key="hibernate.default_schema">dtct_own</prop>                
            <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
            <prop key="hibernate.default_schema">dtct_own</prop>    
            
            
        </props>
........................
definizione in quella nuova
codice:
<bean id="sessionFactory" 
     class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.format_sql">false</prop>
                <prop key="hibernate.jdbc.fetch_size">100</prop>
                <prop key="hibernate.jdbc.batch_size">50</prop>
                <prop key="hibernate.query.factory_class">org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory</prop>                                    <prop key="hibernate.default_schema">dtct_own</prop>    
                
            
                
                
            </props>    
..................
che mi dite?
Grazie