-->
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.  [ 3 posts ] 
Author Message
 Post subject: Many-to-Many with a read-only view for cross-reference table
PostPosted: Fri Oct 07, 2005 4:17 am 
Beginner
Beginner

Joined: Mon Nov 29, 2004 11:51 am
Posts: 31
Hibernate version:3.0.5
Name and version of the database you are using: SQL Server 2000

Hello,
I have a many-to-many assocation that utilizes a view for the cross-reference table.... something like this (short version)...
<class name="MyClass">
<set name="myCollection" table="my_view" cascade="none" lazy="true"...>...</set>
</class>
Whenever I try to update (session.saveOrUpdate()) an instance of MyClass, I get the error you see below.
What do I need to do to make Hibernate see the collection as read-only? I have set cascade="none".
Is there something else I can do?

Code:
org.hibernate.util.JDBCExceptionReporter: View or function 'v_myview' is not updatable because the modification affects multiple base tables. 

org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not delete collection: myCollection#1]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 4:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
dont modify the collection ?

if you have optimistic lock then set optimisc-lock=false on the collection.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 2:05 am 
Beginner
Beginner

Joined: Mon Nov 29, 2004 11:51 am
Posts: 31
Good idea, don't modify the collection :) I thought my app wasn't, but your comment convinced me to have another look and sure enough it was. I thought Hibernate was just doing something mysterious. Thanks for helping me out.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.