-->
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: Nhibernate : how to read data in readonly mode
PostPosted: Thu May 29, 2008 4:18 am 
Newbie

Joined: Thu May 29, 2008 4:11 am
Posts: 8
Hi all,
I read a post that explain how to set a persisten object as read only declaring a persistent object as immutable.

<class name="Foo" table="foo_table" mutable="false">


I want to know if it is possible to set read only mode at runtime, because I have to involve persistent object in two different context : one in readonly mode and one not.

Thank you for your help.
Simone


Top
 Profile  
 
 Post subject: Re: Nhibernate : how to read data in readonly mode
PostPosted: Thu Jun 12, 2008 1:58 am 
Newbie

Joined: Wed May 28, 2008 3:17 am
Posts: 10
sspagna wrote:
<class name="Foo" table="foo_table" mutable="false">
is [it] possible to set read only mode at runtime?


Hi Simone,

Although I haven't done this myself, I read the following on James Kovac's blog:

Quote:
The problem is that you can't insert data into the table since the type is mapped as immutable. However, you can read the NHibernate configuration and mapping files and modify the mapping at runtime. This is done using
Code:
cfg.GetClassMapping(typeof(Invoice)).IsMutable = true
We're switching our immutable entity to a mutable one on the fly!


See http://www.jameskovacs.com/blog/TestingImmutableEntitiesWithNHibernate.aspx for full details.

Phil


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.