-->
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.  [ 3 posts ] 
Author Message
 Post subject: Read-only class
PostPosted: Tue Sep 27, 2005 8:00 pm 
Newbie

Joined: Tue Jun 28, 2005 4:26 pm
Posts: 5
Hey all,

Is there a design-pattern for read-only hibernated objects? In specific, we need a way to flip a flag on a persisted object such that it becomes read-only. My initial inclination was to persist the flag, and check the flag in each set.

This presents a couple of issues though.

a- Nested collections. Someone could add to a contained collection, and I wouldn't know about it.

b- When the object is loaded from the repository, all the setXXX methods are called. Thus, either readOnly would need to always be the last set property, or I'd need to have some kind of callback that indicates that the object is being loaded (and thus, don't check the read-only flag).

I'm pretty sure I'm not the first one to want to do this kind of thing. Is there an existing design-pattern? I've googled without success, and trying to search the forums for "read only" results in hundreds of matches because it won't search on a phrase.

Thanks in advance,

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 2:24 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
you can set @insert and @update = false for any property elements you want to be read only. In your case, that's a lot of elements and it may require two configurations.

I will be building a reporting app in a few months and this is one of the ideas I'm toying with.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 9:28 am 
Newbie

Joined: Tue Jun 28, 2005 4:26 pm
Posts: 5
dennisbyrne wrote:
you can set @insert and @update = false for any property elements you want to be read only. In your case, that's a lot of elements and it may require two configurations.

I will be building a reporting app in a few months and this is one of the ideas I'm toying with.


This needs to be a mode that gets flipped, not a configuration setting.

Somebody is able to modify the object for a period of time, up to the point when it is published. After it's published, then it becomes read-only.

Does that make sense?


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