user3067524
user3067524

Reputation: 527

Spring 5 and Hibernate 5 upgrade

enter image description hereI am upgrading exiting Spring + Hibernate project from previous version to latest. I made it everything working except the data is not saving to database. There is no error as well. Here is the code. Appreciate your help. Thank you!

ApplicationConfiguration.xml

<bean id="providerDao" class="dao.hibernate.ProviderDAOImpl">
        <property name="sessionFactory" ref="AbcSessionFactory"/>
    </bean>
<bean id="ABCSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
    <property name="dataSource" ref="AbcDataSource"/>
     <property name="mappingResources">
      <list>
<value>abc/bean/Provider.hbm.xml</value>
</list>
    </property>
<property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
        <prop key="hibernate.show_sql">${abc.showSql}</prop>
        <prop key="hibernate.default_schema">${abc.dbSchema}</prop>
        <prop key="hibernate.use_outer_join">true</prop>
      </props>
    </property>
</bean>

//DataSource

<!-- DataSource setup -->
  <bean id="AbcDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName"><value>${abc.jndiName}</value></property>
  </bean> 
<bean id="txManager" 
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
    <property name="sessionFactory" ref="ABCSessionFactory"/>
</bean>

DAO Calss

public class ProviderDAOImpl extends HibernateDaoSupport 
                implements ProviderDAO 
{
    private static final Log log = LogFactory.getLog(ProviderDAOImpl.class);
    
    public void save(final Provider instance) 
    {
        log.debug("saving Provider instance");            
        getHibernateTemplate().saveOrUpdate(instance);
        log.debug("save successful");
    }
}

Upvotes: 2

Views: 744

Answers (1)

user3067524
user3067524

Reputation: 527

I have updated configuration xml file with latest namespaces and redo all the beans:bean etc. I am not really sure what the issues is but started working with Hibernate Session session.save();.@Transactions etc.

Upvotes: 1

Related Questions