-->
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: Prevent implicit updates?
PostPosted: Tue Aug 23, 2005 5:57 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Hibernate Version 2.1.3

I'm trying to work this out, have read through everything I can lay my hands on and am still trying to work out an ideal solution to this problem - I don't want any object in my session (whether new or loaded) to be updated without my explicitly calling save or update for that specific object.

I have objects that rely on data that is created by triggers in the database which needs to be immediately available, so when they are explicitly saved I need to flush the session and do a refresh to reload the data into the object <i>but I don't want any other modified objects to be written to the database when I call the flush</i>.

I've looked into using the ILifecycle OnUpdate callback but it's not called unless an explicit update is done, so I can't use the veto there, and the Interceptor approach doesn't let you veto.

My fallback is looking like having to create a internal field to replicate each field accessor that NHibernate uses, create a save method for each of my objects and have an interceptor copy the fields from the internal replicas to the NHibernate fields on save or update and vice versa on load. Mind you, I think this is a nasty kludge.

Are there any alteratives anyone can suggest?

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 10:21 am 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
My experience is with H3, but:

Query.setReadOnly(boolean)
Session.evict(Object)


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.