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.  [ 2 posts ] 
Author Message
 Post subject: problem Mapping a Table View
PostPosted: Wed Nov 26, 2008 2:26 am 
Newbie

Joined: Tue Sep 09, 2008 3:20 am
Posts: 17
Hi,

I have to map a view form oracle database, billow is the mapping file I have created, but when i try to get data using this I get the billow error. Is there anything i have missed in mapping a view.

When i run the code criteria.List() for the firat time it gives me proper data but when i return the list from the metord i get this error.

Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
   <class name="Core.Modules.PatientRegistration.DomainModel.ViewUser, Core" table="VIEW_USER" lazy="false">
      <id name="_id" column="ID" unsaved-value="0" access="field">
         <generator class="native">
         </generator>
         
      </id>
      <property name="_Num" column="NUM" access="field" insert ="false" update ="false"/>
      <property name ="_firstName" column="FIRSTNAME" access="field" insert ="false" update ="false"/>
      <property name ="_middleName" column="MIDDLENAME" access="field" insert ="false" update ="false"/>
      <property name ="_lastName" column="NAME" access="field" insert ="false" update ="false"/>
      <property name="_dateOfBirth" column="DOB" access="field" />
   </class>
</hibernate-mapping>



ORA-01732: data manipulation operation not legal on this view

at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)
at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session)
at NHibernate.Action.EntityUpdateAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultAutoFlushEventListener.OnAutoFlush(AutoFlushEvent event)
at NHibernate.Impl.SessionImpl.AutoFlushIfRequired(ISet`1 querySpaces)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List()


Top
 Profile  
 
 Post subject: Re: problem Mapping a Table View
PostPosted: Wed Nov 26, 2008 1:29 pm 
Newbie

Joined: Wed Nov 26, 2008 6:47 am
Posts: 2
Location: Nantes (France)
Hello arvindragavan,
could you explain what do you mean by :
arvindragavan wrote:
when i return the list from the metord i get this error.


Obviously, the Oracle error is caused by an attempt to update or insert (or delete) data in the view.
I do not know why Hibernate try to modify data into your view (because I do not understand what your application try to do and so I don't know what Hibernate wants to do). But I am sure that Hibernates try to execute an insert, update or delete on the view. And this operation is not permitted, because the view has joins in it.

(extract of the Oracle documentation :)
ORA-01732: data manipulation operation not legal on this view
Cause: An attempt was made to use an UPDATE, INSERT, or DELETE statement on a view that contains expressions or functions or was derived from more than one table. If a join operation was used to create the view or the view contains virtual columns derived from functions or expressions, then the view may only be queried.
Action: UPDATE, INSERT, or DELETE rows in the base tables instead and restrict the operations on the view to queries.

In my opinion, you should try to understand more what your application does (why is it trying to update data?). And maybe you shoud also post the code of the method that has the problem, so that somebody better than me in Hibernate can help you.

Cheers,

Flo


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.