*
The moose likes Other Application Frameworks and the fly likes String-Hibernate read-only mode (FlushMode.NEVER) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "String-Hibernate read-only mode (FlushMode.NEVER) " Watch "String-Hibernate read-only mode (FlushMode.NEVER) " New topic
Author

String-Hibernate read-only mode (FlushMode.NEVER)

Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
Hi guys,

I'm trying to do a save and I'm getting the following error:

org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
at org.springframework.orm.hibernate3.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1098)
at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:616)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:614)
at com.PBCoreApp.dataaccess.impl.BusinessStatisticsDAOImpl.save(BusinessStatisticsDAOImpl.java:37)

I have no idea what I'm doing wrong and how to fix it. I would appreciate any insight you can provide.

Here's my code:

//////////WEB.xml /////////////////

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>false</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>


/////////////////applicationContext.xml////////////////////////

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

<bean id="businessBSTarget" class="com.PBCoreApp.business.impl.BusinessBSImpl">
<property name="businessDao"><ref local="businessDao" /></property>
<bean id="businessBS" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="target">
<ref local="businessBSTarget" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="store*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>


////////////...Dao.java///////////////
this.getHibernateTemplate().save(businessStatisticsCbo);
this.getHibernateTemplate().flush();
this.getHibernateTemplate().clear();


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String-Hibernate read-only mode (FlushMode.NEVER)
 
Similar Threads
Hiberante transaction in Spring
Hibernate insert fails due to generate key failure
How to integrate Hibernate Search w/ Spring
unsatisfied Dependancy exception
Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)