-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: org.springframework.dao.InvalidDataAccessApiUsageException
PostPosted: Sun Aug 07, 2005 9:48 am 
Newbie

Joined: Thu Jul 21, 2005 3:57 am
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 07, 2005 11:48 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
None of this has to do anything with Hibernate, it's all Spring "magic". You have to ask on their forum why they confuse Hibernate users.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 07, 2005 9:13 pm 
Newbie

Joined: Thu Jul 21, 2005 3:57 am
Posts: 5
but I also have a problem on hibernate3 when I use "load"method. but others is ok. There is always exiting a Exception :
...........
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
............

I found some different between hibernate2 and hibernate3 on lazy mechanism .but I can't see that.
can you tell me why?

thanks!
best wish!

_________________
I can fly


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 08, 2005 4:58 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read the migration guide.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.