-->
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.  [ 6 posts ] 
Author Message
 Post subject: how to make a table readonly
PostPosted: Wed Jun 13, 2007 6:00 am 
Newbie

Joined: Wed Jun 13, 2007 5:55 am
Posts: 3
How can we make a table read only making use of hibernate?
Hibernate 3

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 13, 2007 7:50 am 
Beginner
Beginner

Joined: Thu Apr 12, 2007 10:43 am
Posts: 21
Location: Brazil
You probably don't need to write code for that, try setting specific permissions for the table in your database instead. In Oracle, you could grant SELECT permission to an user in a certain table, while denying INSERT, UPDATE and DELETE permissions. If you really want to enforce that restriction programmatically, try to do so in your DAO's by allowing only read operations. Cheers,

Roger


Top
 Profile  
 
 Post subject: Mutability
PostPosted: Wed Jun 13, 2007 10:07 am 
Beginner
Beginner

Joined: Thu Jan 13, 2005 10:50 am
Posts: 30
Location: Minneapolis, MN
If you want to make that entity immutable try something like

<hibernate-mapping>
<class name="ABC" mutable="false">

...
</class>

</hibernate-mapping>

In this way the values of this entity will not be changed and hence the table will not be update-able.

** Don't forget to Rate **
Regard,
Paras


Top
 Profile  
 
 Post subject: how can I restrict insertions?
PostPosted: Thu Jun 14, 2007 3:39 am 
Newbie

Joined: Wed Jun 13, 2007 5:55 am
Posts: 3
In Hibernate reference doc it is mentioned that
Immutable classes, mutable="false", may not be updated or deleted by the application. This allows Hibernate to make some minor performance optimizations.

so ,how can I restrict insertions on this table?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 5:51 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
For This you can use caching. There are fewing caching modes given for special purposes like
to insert : session.setCacheMode(CacheMode.PUT)
to update : GET
to read from database : REFRESH
may be.... This will be helpful for you.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 5:52 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
For This you can use caching. There are fewing caching modes given for special purposes like
go through the link for caching.....
http://www.hibernate.org/hib_docs/v3/re ... mance.html
to insert : session.setCacheMode(CacheMode.PUT)
to update : GET
to read from database : REFRESH
may be.... This will be helpful for you.


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