-->
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.  [ 5 posts ] 
Author Message
 Post subject: Support a way to turn off automatic dirty checking.
PostPosted: Thu Oct 13, 2005 11:04 am 
Newbie

Joined: Thu Oct 13, 2005 11:00 am
Posts: 3
Previusly at JIRA:

Jose Peleteiro:
Automatic dirty checking is a nice features, but at the old-fashioned design (dao.new(), dao.save()) it's not nice.
It may be possible to turn it off at configuration file.

Christian Bauer:
Use a stateless session, read the documentation.

Jose Peleteiro:
StatelessSession does not solve that problem since cache, cascade, event-model, listener, lazy-load... will not work as well.

What I am asking is a way to just turn off automatic dirty checking and continue to use all those features. Is it that bad?

How can I do this (bellow) with automatic dirty, without my client knows that he is using HB, and with lazy-load, cache and etc?

SomeEntity e1 = dao.findById(1);
SomeEntity e2 = dao.findById(1);

e1.setXYZ(123);
e2.setXYZ(123);

if (validation(e1)) dao.save(e1);
if (validation(e2)) dao.save(e1);

Okay, I could do it in a different way, but it is a legancy code and I wish to use Hibernate.

I can understand you all love dirty check (I think its cool as well, but not at every design) and have no focus on it, but if I submit a patch on it, is it welcome?

---------------------------------------------------------------
From StatelessSession JavaDoc:
A command-oriented API for performing bulk operations against a database.

A stateless session does not implement a first-level cache nor interact with any second-level cache, nor does it implement transactional write-behind or automatic dirty checking, nor do operations cascade to associated instances. Collections are ignored by a stateless session. Operations performed via a stateless session bypass Hibernate's event model and interceptors. Stateless sessions are vulnerable to data aliasing effects, due to the lack of a first-level cache.

For certain kinds of transactions, a stateless session may perform slightly faster than a stateful session.

Christian Bauer:
So write a custom interceptor that does nothing on isDirty(). Please continue asking usage questions on the user forum.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 11:13 am 
Newbie

Joined: Thu Oct 13, 2005 11:00 am
Posts: 3
Can you elaborate a little more? I could not find isDirty at org.hibernate.Interceptor nor at event system, neither I found reading the javadocs.

If you meant to say findDirty if I always return a empty int[] shouldn´t it prevent hibernate to save everythink?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 3:15 pm 
Newbie

Joined: Thu Oct 13, 2005 11:00 am
Posts: 3
No one?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 3:22 pm 
Newbie

Joined: Mon Oct 17, 2005 3:42 pm
Posts: 17
the method is findDirty. If I understand the behavior you're looking for, you'd need findDirty to be able to tell somehow that your entity is one your application has explicitely marked for save. Perhaps a transient flag?


Top
 Profile  
 
 Post subject: Re: Support a way to turn off automatic dirty checking.
PostPosted: Sat Oct 16, 2010 10:35 pm 
Newbie

Joined: Sat Oct 16, 2010 10:33 pm
Posts: 1
Hey juzepeleteiro, did you ever find a solution to this problem?


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