-->
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: All fields update & Oracle roles
PostPosted: Wed Apr 27, 2005 3:15 am 
Newbie

Joined: Tue Sep 21, 2004 10:09 am
Posts: 5
Location: Rome, Italy
Hibernate version: 3.0
Name and version of the database you are using: Oracle 9i

Hi,

we are developing a web application that use an Oracle database with roles. The UPDATE permissions are granted on a single-field basis and the Hibernate session use a JDBC connection opened with the same username/password pair entered in the login page. This is not good, I know, but we cannot avoid it: the database is shared with another application that uses the roles.

Based on the user logged in, the web application allows changing only a subset of attributes in a persistent object, but when we try to execute
Code:
session.update(obj)
we noticed that the generated SQL statement contains all the fields in the object, and not only the modified ones. This results in a insufficent privilege exception throwed by Oracle DB if the user does not have sufficient rights for updating some fields in the destination table.

Is it possible to instruct Hibernate to update only the modified attributes in an object without making different mapping files for the same table?

Thanks in advance for any help.

Pietro Pizzo


Top
 Profile  
 
 Post subject: Resolved
PostPosted: Fri Apr 29, 2005 7:20 am 
Newbie

Joined: Tue Sep 21, 2004 10:09 am
Posts: 5
Location: Rome, Italy
Hi All,

I resolved the problem. I have used
Code:
dynamic-update="true"
in the classes' mapping documents. With this option, the SQL UPDATE statements will be generated at runtime and contain only those columns whose values have changed.

Pietro Pizzo


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.