-->
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: Criteria and fetch
PostPosted: Thu Jan 31, 2008 7:16 am 
Beginner
Beginner

Joined: Thu Jan 31, 2008 6:35 am
Posts: 27
Hi,

I use a Criteria to find an object and when I use the list() methode I have an Exception :
object references an unsaved transient instance - save the transient instance before flushing B

But this B object is never use in this Criteria.

I find the problem because in fact just before my Criteria I use a transient object B (I just put the Criteria before)

Why this Criteria try to flush the object B ??

When you lock at the java code, the list() methode call autoFlushIfRequired()
Code:
      AutoFlushEvent event = new AutoFlushEvent([b]querySpaces[/b], this);
      AutoFlushEventListener[] autoFlushEventListener = listeners.getAutoFlushEventListeners();
      for ( int i = 0; i < autoFlushEventListener.length; i++ ) {
         autoFlushEventListener[i].onAutoFlush(event);
      }
In event object, I retrieve all objects that my Criteria use. So object B is not in event.

But autoFlushEventListener call flushEverythingToExecutions() and this methode call flushEntities() that flush all objects including B.

Why hibernate flush all objects for a simple Criteria ?
May I find an option to change this behaviour ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 6:23 am 
Beginner
Beginner

Joined: Thu Jan 31, 2008 6:35 am
Posts: 27
No body know a solution with an option in properties file ?

Or it's maybe a bug ?


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.