-->
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: Selecting Data as readonly
PostPosted: Wed Jun 15, 2005 10:10 am 
Beginner
Beginner

Joined: Tue Aug 03, 2004 1:13 pm
Posts: 23
Hibernate currently provides a way to denote a class as immutable, and thus shoudlnt be dirty checked (as it cannot change).

Is there a way to denote that the resulting objects of a query are to be considered immutable for the session unless explicitly passed to update?

The issue is that we have considerable amounts of data in a long running session, the majority of which (in relation to that particular session) is just "extra imformation" and is effectivly immutable. The application will not change it in anyway. We are not evicting the data, as this results in poor performance due reconstituting and re-querying the db. Additionally these "extra" objects are referenced (via mapped properties) so they cannot be evicted from the session.

Example :


An Invoice has a reference to a Vendor. The user is allowed select from a list of vendors in the UI. This means that all vendors are pulled from the DB, and stored in the session. Since they are in the session the wont ever need tobe re-constituted, and no special prep has tobe done to re-associate the vendor with the session when the user selects any given vendor from the list. So when the Invoice is passed to saveOrUpdate it references a non-transient Vendor.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 4:25 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Query.java

/**
* Entities retrieved by this query will be loaded in
* a read-only mode where Hibernate will never dirty-check
* them or make changes persistent.
*/
public Query setReadOnly(boolean readOnly);


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.