-->
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.  [ 4 posts ] 
Author Message
 Post subject: Inner join causing org.hibernate.AssertionFailure: dirty, ..
PostPosted: Wed Nov 02, 2005 5:59 pm 
Newbie

Joined: Tue Nov 01, 2005 9:55 pm
Posts: 14
Hibernate version:3.0.5
Name and version of the database you are using: Oracle 10.1.0.2

I am not sure the problem is there but it seems that when I am executing the following HQL:

public List getDirtyForAccount(final Account a)
{
return (List) getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
Query query = session.createQuery("select ac from Campaign ac " +
"inner join ac.masterCampaign as mc " +
"where mc.account = :account and ac.dirty = 1")
.setEntity("account", a);

return query.list();
}
});
}

and the middle entity (masterCampaign) does not exist (the account entity is childless) i am getting the following exception:

Full stack trace of any exception that occurs:
SEVERE: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: dirty, but no dirty properties
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:158)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:39)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:711)
at org.hibernate.impl.SessionImpl.prepareQueries(SessionImpl.java:895)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:885)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)



the associations are: Account 1->m MasterCampaign 1->m Campaign

when there are master campaigns, there is no exception on the query.

I am using Spring 1.2.5 to manage the transactions using HibernateDaoSupport and HibernateTemplate.

thanks,
Tomer


Top
 Profile  
 
 Post subject: Problem may be elsewhere?
PostPosted: Wed Nov 02, 2005 6:18 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The query looks fine to me. Is it possible that the problem lies elsewhere? I'd add an explicit flush as the first line of doInHibernate; if that causes the exception then you know that your query is fine. The problem is more likely to lie in some save code somewhere.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 6:40 pm 
Newbie

Joined: Tue Nov 01, 2005 9:55 pm
Posts: 14
Thanks for your reply,

calling session.flush() on the first line still get the same exception on the query, I will try to isoalte the problem more.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 3:03 pm 
Newbie

Joined: Tue Nov 01, 2005 9:55 pm
Posts: 14
i found out that whats causing the error is that inside the Interceptor, i am changing the value of one field (a boolean value) and when trying to load the objects and the session is being flushed, it decided the object is dirty as the boolean value is set to a different value in the transaction, but then again changed in the interceptor, so it ends up having the same value.

i changed the interceptor not to include this value in the calculations inside the interceptor.

just to clarify in case somebody will have the same problem in teh future:

i have property which is a boolean.
a transaction starts.
I am changing the property to false
I am changing the property in the onFlushDirty in the interceptor to true.

when trying to flush the data, it notices that no data changes are done and notify about that


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