-->
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: Application hangs while using org.hibernate.EmptyInterceptor
PostPosted: Sat Jan 20, 2007 7:12 pm 
Beginner
Beginner

Joined: Thu Nov 16, 2006 11:34 am
Posts: 26
Location: Boston
My Requirement is to update a domain object's id (string value) from an external source just before 'Save'. I have a BaseDao class which uses saveOrUpdate(Domain object).

Im planning to use Interceptors for this purpose, I configured an interceptor in my Spring's Hibernate and overrridden onSave. After this call my BaseDao would call saveOrUpdate(domainObject)

I would like the grid id to my domain object and all its association objects
recursively

Code:

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
   
<property name="entityInterceptor">
            <bean class="xxx.utils.GridIdentifierInterceptor" autowire="byType"/>
        </property>
......
</bean>

<bean id="gridIdentifierCreator" class="xxx.utils.CaBigGridIdentifierCreator"/>


Code:
public class MyInterceptor extends EmptyInterceptor {
    private GridIdentifierCreator gridIdentifierCreator;
   
    public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
        boolean localMod = false;
        DomainObject domainObject = (DomainObject) entity;
   String bigId = gridIdentifierCreator.getGridIdentifier(domainObject.getId().toString());      
   domainObject.setGridId(bigid);
   return true;
    }
}




After running, I can step through my debugger and I see that my interceptopr is called for all my association objects as well. However after all the objects are intercepted, the code just hangs with the below log message. My jsp just hangs. I dont know I have to overrid other methods for this interceptor and where things are going wrong.

Can anyone suggest what I should do?






Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2.1

Mapping documents:
annotated classes
Code between sessionFactory.openSession() and session.close():
I use Spring's HibernateUtil
Full stack trace of any exception that occurs:
2007-01-20 17:23:08,468 DEBUG [org.hibernate.jdbc.AbstractBatcher] - Executing batch size: 1

Name and version of the database you are using:
Oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 20, 2007 9:12 pm 
Beginner
Beginner

Joined: Thu Nov 16, 2006 11:34 am
Posts: 26
Location: Boston
damn! I was using Toad for the first time and it was locking my database without autocommitting. Frustrating ;(.

this has nothing to do with interceptors anyways.


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.