I try to add one child object ,but always have a problem:
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
parent.hbm.xml:
..........
<set
name="child"
lazy="true "
cascade="save-update"
inverse="true"
>
<key
column="parentID"
>
</key>
<one-to-many
class="com.child"
/>
</set>
.........
child.hbm.xml:
..........
<many-to-one
name="parent"
class="com.parent"
cascade="save-update"
outer-join="auto"
update="true"
insert="true"
access="property"
column="parentID"
/>
...............
I use the org.springframework.orm.hibernate3.support.OpenSessionInViewFilter on my web.xml:
...................
<filter>
<filter-name>test_OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>test_OpenSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
..................
I try to check where I used "readOnly",but none.
and I check where I made mistakes about hibernate3 on *.xml,but I don't find any mistake.so can you tell me where I make mistake?
best wish!
_________________ I can fly
|